OKlibrary  0.2.1.6
IteratedBlockCipher.mac
Go to the documentation of this file.
00001 /* Oliver Kullmann, 23.12.2009 (Swansea) */
00002 /* Copyright 2009 Oliver Kullmann
00003 This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
00004 it and/or modify it under the terms of the GNU General Public License as published by
00005 the Free Software Foundation and included in this library; either version 3 of the
00006 License, or any later version. */
00007 
00022 oklib_include("OKlib/ComputerAlgebra/TestSystem/Lisp/Asserts.mac")$
00023 
00024 kill(f)$
00025 
00026 /* *******************************************************************
00027    * Compositional iterated block ciphers with iterated key schedule *
00028    *******************************************************************
00029 */
00030 
00031 okltest_key_schedule_0(f) := block([r,F,k],
00032   F : f(r),
00033   assert(F(k,0) = k),
00034   assert(F(k,1) = r(k,1)),
00035   assert(F(k,2) = r(r(k,1),2)),
00036   assert(F(k,3) = r(r(r(k,1),2),3)),
00037   true)$
00038 
00039 okltest_ibc_0(f) := block([r,c,t,C,m,k],
00040   C : f(r,t,c),
00041   assert(C(m,k,0) = m),
00042   assert(C(m,k,1) = c(t(m,0),k)),
00043   assert(C(m,k,2) = c(t(c(t(m,0),k),1),r(k,1))),
00044   assert(C(m,k,3) = c(t(c(t(c(t(m,0),k),1),r(k,1)),2),r(r(k,1),2))),
00045   true)$
00046 
00047