OKlibrary  0.2.1.6
RoundFunction.mac
Go to the documentation of this file.
```00001 /* Oliver Kullmann, 20.3.2011 (Swansea) */
00002 /* Copyright 2011 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/DataStructures/Lisp/Lists.mac")\$
00023 oklib_include("OKlib/ComputerAlgebra/Cryptology/Lisp/CryptoSystems/DataEncryptionStandard/Sboxes.mac")\$
00024
00025 des_expansion : [
00026 32,1,2,3,4,5,4,5,6,7,8,9,
00027 8,9,10,11,12,13,12,13,14,15,16,17,
00028 16,17,18,19,20,21,20,21,22,23,24,25,
00029 24,25,26,27,28,29,28,29,30,31,32,1]\$
00030
00031 des_pbox : [
00032 16,7,20,21,29,12,28,17,1,15,23,26,5,18,31,10,
00033 2,8,24,14,32,27,3,9,19,13,30,6,22,11,4,25]\$
00034
00035 /* previous and current are boolean vectors of length 32, key is a boolean
00036    vector of length 48:
00037 */
00038 des_round(previous,current,key) := block(
00039  [result : map(lambda([x],current[x]), des_expansion)],
00040   result : mod(result + key, 2),
00041   result : partition_elements(result, 6),
00042   result : lappend(create_list(des_sbox_bf(i)(result[i]),i,1,8)),
00043   result : map(lambda([x],result[x]), des_pbox),
00044   mod(result + previous, 2))\$
00045
```