diff options
author | Camil Staps | 2015-04-23 09:13:44 +0200 |
---|---|---|
committer | Camil Staps | 2015-04-23 09:13:44 +0200 |
commit | 6ceb28c6d1f2e530859e314d2fbb07446e037c61 (patch) | |
tree | f75a301f8fefed4af498ae87d024ed1fd50cf2d7 /pypride.py | |
parent | Updated license with personal details & added it (diff) |
Cleanup; removed license
Diffstat (limited to 'pypride.py')
-rw-r--r-- | pypride.py | 23 |
1 files changed, 5 insertions, 18 deletions
@@ -6,20 +6,6 @@ # # Python implementation of the PRIDE cipher # Copyright (C) 2015 Camil Staps (info@camilstaps.nl) -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # ============================================================================= @@ -86,14 +72,15 @@ class Pride: return number2string_N(state,8) -# 4 to 4-bit S-Box and its inverse +""" 4 to 4-bit S-Box and its inverse """ Sbox= [0x0,0x4,0x8,0xf,0x1,0x5,0xe,0x9,0x2,0x7,0xa,0xc,0xb,0xd,0x6,0x3] Sbox_inv = [Sbox.index(x) for x in xrange(16)] -# 64-bit permutation P and its inverse -PBox = [0,16,32,48,1,17,33,49,2,18,34,50,3,19,35,51,4,20,36,52,5,21,37,53,6,22,38,54,7,23,39,55,8,24,40,56,9,25,41,57,10,26,42,58,11,27,43,59,12,28,44,60,13,29,45,61,14,30,46,62,15,31,47,63] + +""" 64-bit permutation P and its inverse """ +PBox = [0, 16, 32, 48, 1, 17, 33, 49, 2, 18, 34, 50, 3, 19, 35, 51, 4, 20, 36, 52, 5, 21, 37, 53, 6, 22, 38, 54, 7, 23, 39, 55, 8, 24, 40, 56, 9, 25, 41, 57, 10, 26, 42, 58, 11, 27, 43, 59, 12, 28, 44, 60, 13, 29, 45, 61, 14, 30, 46, 62, 15, 31, 47, 63] PBox_inv = [PBox.index(x) for x in xrange(64)] -# Matrices for permutation in the L layer +""" Matrices for permutation in the L layer """ L0 = [[0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0], [0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0], [0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0], |