-
+ 5391B6BDDACB52E015B16F67B366754D20FBA03A96B1D036A44F0D71B85122C3F5A0A15123BC4E353669418B7038161F2F820C36C12B6B5D0DDABD3A8AC6BA07
smg_comms/tests/test_serpent.adb
(0 . 0)(1 . 31)
981 -- S.MG, 2018
982
983 with Raw_Types; use Raw_Types;
984 with Serpent; use Serpent;
985
986 package body Test_Serpent is
987
988 procedure Selftest is
989 K : Key := (others => 0);
990 P : Block := (others => 0);
991 P2, C : Block;
992 W : Key_Schedule;
993 begin
994 for I in 1 .. 128 loop
995 Prepare_Key(K, W);
996 Encrypt(W, P, C);
997 Decrypt(W, C, P2);
998 if (P2 /= P) then
999 raise Implementation_Error;
1000 end if;
1001 P := K( 0 .. 15);
1002 K( 0 .. 15) := K(16 .. 31);
1003 K(16 .. 31) := C;
1004 end loop;
1005 if C /= (16#A2#, 16#46#, 16#AB#, 16#69#, 16#0A#, 16#E6#, 16#8D#, 16#FB#,
1006 16#02#, 16#04#, 16#CB#, 16#E2#, 16#8E#, 16#D8#, 16#EB#, 16#7A#)
1007 then
1008 raise Implementation_Error;
1009 end if;
1010 end Selftest;
1011 end Test_Serpent;