raw
smg_comms_packing...    1 -------------------------------------------------------------------------------
smg_comms_packing... 2 -- S.MG, 2018;
smg_comms_packing... 3 --
smg_comms_packing... 4 -- Serpent Blockcipher
smg_comms_packing... 5 --
smg_comms_packing... 6 -- Copyright (c) 1998 Markus G. Kuhn <mkuhn@acm.org>. All rights reserved.
smg_comms_packing... 7 --
smg_comms_packing... 8 --
smg_comms_packing... 9 -------------------------------------------------------------------------------
smg_comms_packing... 10 --
smg_comms_packing... 11 -- This is the Ada95 reference implementation of the Serpent cipher
smg_comms_packing... 12 -- submitted by Ross Anderson, Eli Biham and Lars Knudson in June 1998 to
smg_comms_packing... 13 -- the NIST Advanced Encryption Standard (AES) contest. Please note that
smg_comms_packing... 14 -- this is a revised algorithm that is not identical to the old version
smg_comms_packing... 15 -- presented at the 1998 Fast Software Encryption Workshop.
smg_comms_packing... 16 -- <http://www.cs.technion.ac.il/~biham/Reports/Serpent/>
smg_comms_packing... 17 --
smg_comms_packing... 18 -- Compiled with GNAT 3.10p under Linux, this implementation encrypts and
smg_comms_packing... 19 -- decrypts with 20.8 Mbit/s on a 300 MHz Pentium II.
smg_comms_packing... 20 --
smg_comms_packing... 21 -------------------------------------------------------------------------------
smg_comms_packing... 22
smg_comms_packing... 23 with Interfaces; use Interfaces;
smg_comms_packing... 24 with Raw_Types;
smg_comms_packing... 25
smg_comms_packing... 26 package Serpent is
smg_comms_packing... 27
smg_comms_packing... 28 pragma Pure(Serpent);
smg_comms_packing... 29
smg_comms_packing... 30 subtype Bytes is Raw_Types.Octets;
smg_comms_packing... 31 type Words is array (Integer range <>) of Unsigned_32;
smg_comms_packing... 32 subtype Block is Bytes (0 .. 15);
smg_comms_packing... 33 subtype Key is Bytes (0 .. 31);
smg_comms_packing... 34 subtype Key_Schedule is Words (-8 .. 131);
smg_comms_packing... 35
smg_comms_packing... 36 procedure Prepare_Key (K : in Key; W : out Key_Schedule);
smg_comms_packing... 37
smg_comms_packing... 38 procedure Encrypt (W : in Key_Schedule; Plaintext : in Block;
smg_comms_packing... 39 Ciphertext : out Block);
smg_comms_packing... 40
smg_comms_packing... 41 procedure Decrypt (W : in Key_Schedule; Ciphertext : in Block;
smg_comms_packing... 42 Plaintext : out Block);
smg_comms_packing... 43
smg_comms_packing... 44 end Serpent;