From ea99441e0da927e5a40cf21311265c7e22974f12 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Mon, 13 Feb 2017 13:21:17 +1100 Subject: Preference dedupe removed, bignum library obtained from internet (will be replaced later) --- src/crypto-types-random_source.adb | 55 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/crypto-types-random_source.adb (limited to 'src/crypto-types-random_source.adb') diff --git a/src/crypto-types-random_source.adb b/src/crypto-types-random_source.adb new file mode 100644 index 0000000..5fd4dbb --- /dev/null +++ b/src/crypto-types-random_source.adb @@ -0,0 +1,55 @@ +package body Crypto.Types.Random_Source is + + procedure Read(This : in out Random_Source; Byte_Array : out Bytes) is + begin + for I in Byte_Array'Range loop + Read(Random_Source'class(This),Byte_Array(I)); + end loop; + end Read; + + ---------------------------------------------------------------------- + + procedure Read(This : in out Random_Source; B : out B_Block128) is + begin + for I in B'Range loop + Read(Random_Source'class(This),B(I)); + end loop; + end Read; + + ---------------------------------------------------------------------- + + procedure Read(This : in out Random_Source; W : out Word) is + B : Byte_Word; + begin + This.Read(Bytes(B)); + W := To_Word(B); + end Read; + + ---------------------------------------------------------------------- + + procedure Read(This : in out Random_Source; Word_Array : out Words) is + begin + for I in Word_Array'Range loop + This.Read(Word_Array(I)); + end loop; + end Read; + + ---------------------------------------------------------------------- + + procedure Read(This : in out Random_Source; D : out DWord) is + B : Byte_DWord; + begin + This.Read(Bytes(B)); + D := To_DWord(B); + end Read; + + ---------------------------------------------------------------------- + + procedure Read(This : in out Random_Source; DWord_Array : out DWords) is + begin + for I in DWord_Array'Range loop + This.Read(DWord_Array(I)); + end loop; + end Read; + +end Crypto.Types.Random_Source; -- cgit