Skip to content

Commit

Permalink
Add HIGHT lightweight block cipher (GH #672)
Browse files Browse the repository at this point in the history
  • Loading branch information
noloader committed Jun 24, 2018
1 parent 32e2be6 commit 2f5b110
Show file tree
Hide file tree
Showing 13 changed files with 492 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Filelist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ gzip.h
hashfwd.h
hex.cpp
hex.h
hight.h
hight.cpp
hkdf.h
hmac.cpp
hmac.h
Expand Down Expand Up @@ -451,6 +453,7 @@ TestVectors/eax.txt
TestVectors/esign.txt
TestVectors/gcm.txt
TestVectors/hkdf.txt
TestVectors/hight.txt
TestVectors/hmac.txt
TestVectors/kalyna.txt
TestVectors/keccak.txt
Expand Down
3 changes: 2 additions & 1 deletion TestVectors/all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ Test: TestVectors/aria.txt
Test: TestVectors/kalyna.txt
Test: TestVectors/threefish.txt
Test: TestVectors/sm4.txt
Test: TestVectors/hight.txt
Test: TestVectors/cham.txt
Test: TestVectors/lea.txt
Test: TestVectors/simon.txt
Test: TestVectors/speck.txt
Test: TestVectors/cham.txt
Test: TestVectors/salsa.txt
Test: TestVectors/chacha.txt
#Test: TestVectors/tls_chacha.txt
Expand Down
107 changes: 107 additions & 0 deletions TestVectors/hight.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
AlgorithmType: SymmetricCipher
Name: HIGHT/ECB
#
Source: HIGHT reference zip file, file KISA_HIGHT_ECB.c
Comment: HIGHT/ECB, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
Plaintext: D7 6D 0D 18 32 7E C5 62
Ciphertext: E4 BC 2E 31 22 77 E4 DD
Test: Encrypt
#
Source: CHAM reference implementation

This comment has been minimized.

Copy link
@randombit

randombit Jun 25, 2018

This and later comments should refer to 'HIGHT reference implementation' yes?

This comment has been minimized.

Copy link
@noloader

noloader Jun 25, 2018

Author Collaborator

Oh, yes. Thanks.

Comment: HIGHT/ECB, 128-bit key
Key: 29 23 BE 84 E1 6C D6 AE 52 90 49 F1 F1 BB E9 EB
Plaintext: B3 A6 DB 3C 87 0C 3E 99
Ciphertext: 23 CA D1 A3 CD DF 7E AB
Test: Encrypt
#
Source: CHAM reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: 24 5E 0D 1C 06 B7 47 DE B3 12 4D C8 43 BB 8B A6
Plaintext: 1F 03 5A 7D 09 38 25 1F
Ciphertext: 52 BD 91 BB 26 F8 ED 99
Test: Encrypt
#
Source: CHAM reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: 5D D4 CB FC 96 F5 45 3B 13 0D 89 0A 1C DB AE 32
Plaintext: 20 9A 50 EE 40 78 36 FD
Ciphertext: 95 02 B4 6D 87 B4 41 67
Test: Encrypt
#
Source: CHAM reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: 12 49 32 F6 9E 7D 49 DC AD 4F 14 F2 44 40 66 D0
Plaintext: 6B C4 30 B7 32 3B A1 22
Ciphertext: 20 CB CF 41 65 24 E5 A6
Test: Encrypt
#
Source: CHAM reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: F6 22 91 9D E1 8B 1F DA B0 CA 99 02 B9 72 9D 49
Plaintext: 2C 80 7E C5 99 D5 E9 80
Ciphertext: F3 1C 89 E6 6C 4F 5A 6F
Test: Encrypt
#
Source: CHAM reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: B2 EA C9 CC 53 BF 67 D6 BF 14 D6 7E 2D DC 8E 66
Plaintext: 83 EF 57 49 61 FF 69 8F
Ciphertext: 39 21 C8 3B FE 5E 59 6E
Test: Encrypt
#
Source: CHAM reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: 61 CD D1 1E 9D 9C 16 72 72 E6 1D F0 84 4F 4A 77
Plaintext: 02 D7 E8 39 2C 53 CB C9
Ciphertext: 98 2F D7 56 17 44 97 BF
Test: Encrypt
#
Source: CHAM reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: 12 1E 33 74 9E 0C F4 D5 D4 9F D4 A4 59 7E 35 CF
Plaintext: 32 22 F4 CC CF D3 90 2D
Ciphertext: BB 80 F5 0B 35 11 5B A8
Test: Encrypt
#
Source: CHAM reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: 5D D4 CB FC 96 F5 45 3B 13 0D 89 0A 1C DB AE 32
Plaintext : 20 9A 50 EE 40 78 36 FD
Ciphertext : 95 02 B4 6D 87 B4 41 67
Test: Encrypt
#
Source: CHAM reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: 12 49 32 F6 9E 7D 49 DC AD 4F 14 F2 44 40 66 D0
Plaintext : 6B C4 30 B7 32 3B A1 22
Ciphertext : 20 CB CF 41 65 24 E5 A6
Test: Encrypt
#
Source: CHAM reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: F6 22 91 9D E1 8B 1F DA B0 CA 99 02 B9 72 9D 49
Plaintext : 2C 80 7E C5 99 D5 E9 80
Ciphertext : F3 1C 89 E6 6C 4F 5A 6F
Test: Encrypt
#
Source: CHAM reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: B2 EA C9 CC 53 BF 67 D6 BF 14 D6 7E 2D DC 8E 66
Plaintext : 83 EF 57 49 61 FF 69 8F
Ciphertext : 39 21 C8 3B FE 5E 59 6E
Test: Encrypt
#
Source: CHAM reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: 61 CD D1 1E 9D 9C 16 72 72 E6 1D F0 84 4F 4A 77
Plaintext : 02 D7 E8 39 2C 53 CB C9
Ciphertext : 98 2F D7 56 17 44 97 BF
Test: Encrypt
#
Source: CHAM reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: 12 1E 33 74 9E 0C F4 D5 D4 9F D4 A4 59 7E 35 CF
Plaintext : 32 22 F4 CC CF D3 90 2D
Ciphertext : BB 80 F5 0B 35 11 5B A8
Test: Encrypt
4 changes: 4 additions & 0 deletions bench1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,9 @@ void Benchmark2(double t, double hertz)
std::cout << "\n<TR><TH>Algorithm<TH>MiB/Second" << cpb;
std::cout << "<TH>Microseconds to<BR>Setup Key and IV" << cpk;

BenchMarkByName<SymmetricCipher>("HIGHT/CTR");
return;

std::cout << "\n<TBODY style=\"background: white;\">";
{
#if CRYPTOPP_AESNI_AVAILABLE
Expand Down Expand Up @@ -584,6 +587,7 @@ void Benchmark2(double t, double hertz)
BenchMarkByName<SymmetricCipher>("AES/ECB", 16);
BenchMarkByName<SymmetricCipher>("ARIA/CTR", 16);
BenchMarkByName<SymmetricCipher>("ARIA/CTR", 32);
BenchMarkByName<SymmetricCipher>("HIGHT/CTR");
BenchMarkByName<SymmetricCipher>("Camellia/CTR", 16);
BenchMarkByName<SymmetricCipher>("Camellia/CTR", 32);
BenchMarkByName<SymmetricCipher>("Twofish/CTR");
Expand Down
4 changes: 2 additions & 2 deletions cryptest.nmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@

# If you use 'make sources' from Linux makefile, then add 'winpipes.cpp' to the list below.

LIB_SRCS = cryptlib.cpp cpu.cpp integer.cpp 3way.cpp adler32.cpp algebra.cpp algparam.cpp arc4.cpp aria-simd.cpp aria.cpp ariatab.cpp asn.cpp authenc.cpp base32.cpp base64.cpp basecode.cpp bfinit.cpp blake2-simd.cpp blake2.cpp blowfish.cpp blumshub.cpp camellia.cpp cast.cpp casts.cpp cbcmac.cpp ccm.cpp chacha.cpp cham.cpp cham-simd.cpp channels.cpp cmac.cpp crc-simd.cpp crc.cpp default.cpp des.cpp dessp.cpp dh.cpp dh2.cpp dll.cpp dsa.cpp eax.cpp ec2n.cpp eccrypto.cpp ecp.cpp elgamal.cpp emsa2.cpp eprecomp.cpp esign.cpp files.cpp filters.cpp fips140.cpp fipstest.cpp gcm-simd.cpp gcm.cpp gf256.cpp gf2_32.cpp gf2n.cpp gfpcrypt.cpp gost.cpp gzip.cpp hex.cpp hmac.cpp hrtimer.cpp ida.cpp idea.cpp iterhash.cpp kalyna.cpp kalynatab.cpp keccak.cpp lea.cpp lea-simd.cpp luc.cpp mars.cpp marss.cpp md2.cpp md4.cpp md5.cpp misc.cpp modes.cpp mqueue.cpp mqv.cpp nbtheory.cpp neon-simd.cpp network.cpp oaep.cpp osrng.cpp padlkrng.cpp panama.cpp pkcspad.cpp poly1305.cpp polynomi.cpp pssr.cpp pubkey.cpp queue.cpp rabin.cpp randpool.cpp rc2.cpp rc5.cpp rc6.cpp rdrand.cpp rdtables.cpp rijndael-simd.cpp rijndael.cpp ripemd.cpp rng.cpp rsa.cpp rw.cpp safer.cpp salsa.cpp scrypt.cpp seal.cpp seed.cpp serpent.cpp sha-simd.cpp sha.cpp sha3.cpp shacal2-simd.cpp shacal2.cpp shark.cpp sharkbox.cpp simon.cpp simon-simd.cpp skipjack.cpp sm3.cpp sm4.cpp socketft.cpp sosemanuk.cpp speck.cpp speck-simd.cpp square.cpp squaretb.cpp sse-simd.cpp strciphr.cpp tea.cpp tftables.cpp threefish.cpp tiger.cpp tigertab.cpp trdlocal.cpp ttmac.cpp tweetnacl.cpp twofish.cpp vmac.cpp wait.cpp wake.cpp whrlpool.cpp winpipes.cpp xtr.cpp xtrcrypt.cpp zdeflate.cpp zinflate.cpp zlib.cpp
LIB_SRCS = cryptlib.cpp cpu.cpp integer.cpp 3way.cpp adler32.cpp algebra.cpp algparam.cpp arc4.cpp aria-simd.cpp aria.cpp ariatab.cpp asn.cpp authenc.cpp base32.cpp base64.cpp basecode.cpp bfinit.cpp blake2-simd.cpp blake2.cpp blowfish.cpp blumshub.cpp camellia.cpp cast.cpp casts.cpp cbcmac.cpp ccm.cpp chacha.cpp cham.cpp cham-simd.cpp channels.cpp cmac.cpp crc-simd.cpp crc.cpp default.cpp des.cpp dessp.cpp dh.cpp dh2.cpp dll.cpp dsa.cpp eax.cpp ec2n.cpp eccrypto.cpp ecp.cpp elgamal.cpp emsa2.cpp eprecomp.cpp esign.cpp files.cpp filters.cpp fips140.cpp fipstest.cpp gcm-simd.cpp gcm.cpp gf256.cpp gf2_32.cpp gf2n.cpp gfpcrypt.cpp gost.cpp gzip.cpp hex.cpp hight.cpp hmac.cpp hrtimer.cpp ida.cpp idea.cpp iterhash.cpp kalyna.cpp kalynatab.cpp keccak.cpp lea.cpp lea-simd.cpp luc.cpp mars.cpp marss.cpp md2.cpp md4.cpp md5.cpp misc.cpp modes.cpp mqueue.cpp mqv.cpp nbtheory.cpp neon-simd.cpp network.cpp oaep.cpp osrng.cpp padlkrng.cpp panama.cpp pkcspad.cpp poly1305.cpp polynomi.cpp pssr.cpp pubkey.cpp queue.cpp rabin.cpp randpool.cpp rc2.cpp rc5.cpp rc6.cpp rdrand.cpp rdtables.cpp rijndael-simd.cpp rijndael.cpp ripemd.cpp rng.cpp rsa.cpp rw.cpp safer.cpp salsa.cpp scrypt.cpp seal.cpp seed.cpp serpent.cpp sha-simd.cpp sha.cpp sha3.cpp shacal2-simd.cpp shacal2.cpp shark.cpp sharkbox.cpp simon.cpp simon-simd.cpp skipjack.cpp sm3.cpp sm4.cpp socketft.cpp sosemanuk.cpp speck.cpp speck-simd.cpp square.cpp squaretb.cpp sse-simd.cpp strciphr.cpp tea.cpp tftables.cpp threefish.cpp tiger.cpp tigertab.cpp trdlocal.cpp ttmac.cpp tweetnacl.cpp twofish.cpp vmac.cpp wait.cpp wake.cpp whrlpool.cpp winpipes.cpp xtr.cpp xtrcrypt.cpp zdeflate.cpp zinflate.cpp zlib.cpp

LIB_OBJS = cryptlib.obj cpu.obj integer.obj 3way.obj adler32.obj algebra.obj algparam.obj arc4.obj aria-simd.obj aria.obj ariatab.obj asn.obj authenc.obj base32.obj base64.obj basecode.obj bfinit.obj blake2-simd.obj blake2.obj blowfish.obj blumshub.obj camellia.obj cast.obj casts.obj cbcmac.obj ccm.obj chacha.obj cham.obj cham-simd.obj channels.obj cmac.obj crc-simd.obj crc.obj default.obj des.obj dessp.obj dh.obj dh2.obj dll.obj dsa.obj eax.obj ec2n.obj eccrypto.obj ecp.obj elgamal.obj emsa2.obj eprecomp.obj esign.obj files.obj filters.obj fips140.obj fipstest.obj gcm-simd.obj gcm.obj gf256.obj gf2_32.obj gf2n.obj gfpcrypt.obj gost.obj gzip.obj hex.obj hmac.obj hrtimer.obj ida.obj idea.obj iterhash.obj kalyna.obj kalynatab.obj keccak.obj lea.obj lea-simd.obj luc.obj mars.obj marss.obj md2.obj md4.obj md5.obj misc.obj modes.obj mqueue.obj mqv.obj nbtheory.obj neon-simd.obj network.obj oaep.obj osrng.obj padlkrng.obj panama.obj pkcspad.obj poly1305.obj polynomi.obj pssr.obj pubkey.obj queue.obj rabin.obj randpool.obj rc2.obj rc5.obj rc6.obj rdrand.obj rdtables.obj rijndael-simd.obj rijndael.obj ripemd.obj rng.obj rsa.obj rw.obj safer.obj salsa.obj scrypt.obj seal.obj seed.obj serpent.obj sha-simd.obj sha.obj sha3.obj shacal2-simd.obj shacal2.obj shark.obj sharkbox.obj simon.obj simon-simd.obj skipjack.obj sm3.obj sm4.obj socketft.obj sosemanuk.obj speck.obj speck-simd.obj square.obj squaretb.obj sse-simd.obj strciphr.obj tea.obj tftables.obj threefish.obj tiger.obj tigertab.obj trdlocal.obj ttmac.obj tweetnacl.obj twofish.obj vmac.obj wait.obj wake.obj whrlpool.obj winpipes.obj xtr.obj xtrcrypt.obj zdeflate.obj zinflate.obj zlib.obj
LIB_OBJS = cryptlib.obj cpu.obj integer.obj 3way.obj adler32.obj algebra.obj algparam.obj arc4.obj aria-simd.obj aria.obj ariatab.obj asn.obj authenc.obj base32.obj base64.obj basecode.obj bfinit.obj blake2-simd.obj blake2.obj blowfish.obj blumshub.obj camellia.obj cast.obj casts.obj cbcmac.obj ccm.obj chacha.obj cham.obj cham-simd.obj channels.obj cmac.obj crc-simd.obj crc.obj default.obj des.obj dessp.obj dh.obj dh2.obj dll.obj dsa.obj eax.obj ec2n.obj eccrypto.obj ecp.obj elgamal.obj emsa2.obj eprecomp.obj esign.obj files.obj filters.obj fips140.obj fipstest.obj gcm-simd.obj gcm.obj gf256.obj gf2_32.obj gf2n.obj gfpcrypt.obj gost.obj gzip.obj hex.obj hight.obj hmac.obj hrtimer.obj ida.obj idea.obj iterhash.obj kalyna.obj kalynatab.obj keccak.obj lea.obj lea-simd.obj luc.obj mars.obj marss.obj md2.obj md4.obj md5.obj misc.obj modes.obj mqueue.obj mqv.obj nbtheory.obj neon-simd.obj network.obj oaep.obj osrng.obj padlkrng.obj panama.obj pkcspad.obj poly1305.obj polynomi.obj pssr.obj pubkey.obj queue.obj rabin.obj randpool.obj rc2.obj rc5.obj rc6.obj rdrand.obj rdtables.obj rijndael-simd.obj rijndael.obj ripemd.obj rng.obj rsa.obj rw.obj safer.obj salsa.obj scrypt.obj seal.obj seed.obj serpent.obj sha-simd.obj sha.obj sha3.obj shacal2-simd.obj shacal2.obj shark.obj sharkbox.obj simon.obj simon-simd.obj skipjack.obj sm3.obj sm4.obj socketft.obj sosemanuk.obj speck.obj speck-simd.obj square.obj squaretb.obj sse-simd.obj strciphr.obj tea.obj tftables.obj threefish.obj tiger.obj tigertab.obj trdlocal.obj ttmac.obj tweetnacl.obj twofish.obj vmac.obj wait.obj wake.obj whrlpool.obj winpipes.obj xtr.obj xtrcrypt.obj zdeflate.obj zinflate.obj zlib.obj

TEST_SRCS = bench1.cpp bench2.cpp test.cpp validat0.cpp validat1.cpp validat2.cpp validat3.cpp validat4.cpp datatest.cpp regtest1.cpp regtest2.cpp regtest3.cpp fipsalgt.cpp dlltest.cpp fipstest.cpp

Expand Down
2 changes: 2 additions & 0 deletions cryptlib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
<ClCompile Include="gost.cpp" />
<ClCompile Include="gzip.cpp" />
<ClCompile Include="hex.cpp" />
<ClCompile Include="hight.cpp" />
<ClCompile Include="hmac.cpp" />
<ClCompile Include="hrtimer.cpp" />
<ClCompile Include="ida.cpp" />
Expand Down Expand Up @@ -422,6 +423,7 @@
<ClInclude Include="gost.h" />
<ClInclude Include="gzip.h" />
<ClInclude Include="hex.h" />
<ClInclude Include="hight.h" />
<ClInclude Include="hkdf.h" />
<ClInclude Include="hmac.h" />
<ClInclude Include="hmqv.h" />
Expand Down
6 changes: 6 additions & 0 deletions cryptlib.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@
<ClCompile Include="hex.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="hight.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="hmac.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down Expand Up @@ -660,6 +663,9 @@
<ClInclude Include="hex.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="hight.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="hkdf.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down
Loading

1 comment on commit 2f5b110

@noloader
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also see Issue 672.

Please sign in to comment.