cryptography - Serpent Sbox transformation -



cryptography - Serpent Sbox transformation -

consider have sample key

15fc0d48 d7f8199c be399183 4d96f327 10000000 00000000 00000000 00000000 w-8 w-7 w-6 w-5 w-4 w-3 w-2 w-1

creating first k0 key schedule pair

(k0,k1,k2,k3)=s3(w0,w1,w2,w3)=k0

using formula serpent key schdule

wi=(wi-8 xor wi-5 xor wi-3 xor wi-1 xor phi xor i)<<<11

1) i=0

w0=w-8 xor w-5 xor w-3 xor w-1 xor 9e3779b9 xor 0<<<11=15fc0d48 xor 4d96f327 xor 00000000 xor 00000000 xor 9e3779b9 xor 0 <<<11=ec3eb632

2) i=1

w1=w-7 xor w-4 xor w-2 xor w0 xor 9e3779b9 xor 1<<<11=d7f8199c xor 10000000 xor 00000000 xor ec3eb632 xor 9e3779b9 xor 1<<<11=8eb0b5af

3) i=2

w2=w-6 xor w-3 xor w-1 xor w1 xor 9e3779b9 xor 2<<<11=be399183 xor 00000000 xor 00000000 xor 8eb0b5af xor 9e3779b9 xor 2<<<11=f2ecbd75

4) i=3

w3=w-5 xor w-2 xor w0 xor w2 xor 9e3779b9 xor 3<<<11=4d96f327 xor 00000000 xor ec3eb632 xor f2ecbd75 xor 9e3779b9 xor 3<<<11=9c0ed66b

for k0 created sbox3

s3(w0,w1,w2,w3) ec3eb632 binary form: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 11|10|11|00|00|11|11|10|10|11|01|10|00|11|00|10| after sbox3 11101010001111001110110001101100 ea3cec6c 8eb0b5af binary form: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 10|00|11|10|10|11|00|00|10|11|01|01|10|10|11|11 after sbox3 10110110101100101000111001001111 b6b28e4f f2ecbd75 binary form: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 11|11|00|10|11|10|11|00|10|11|11|01|01|11|01|01 after sbox3 11010110011111101111001111001001 d67ef3c9 9c0ed66b binary form: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 10|01|11|00|00|00|11|10|11|01|01|10|01|10|10|11 after sbox3 10111011010111001001110001100010 bb5c9c62 k0={ea3cec6c b6b28e4f d67ef3c9 bb5c9c62}

i utilize solution in c# sbox transformation:

string key="10011100000011101101011001101011"; prek=""; uint32 k; (int = sboxpos; < sboxpos + 1; i++) { (int i2 = 0; i2 < 16; i2++) { prek += key.substring(sbox[i, i2] * 2, 2); //multiplying on 2 move byte on appropriate position, in illustration above transform hex binary have 32bits, sbox'es moves bytes. e.g. 15's byte 15*2=30's position plus 2 characters } } k = convert.touint32(prek, 2);

my question doing key schedule of serpent right, in other implementation uses &, operands in sbox'es. have same result applying sbox transformation in code above? thanks!

cryptography

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -