diff options
author | Jed Barber <jjbarber@y7mail.com> | 2017-02-13 13:21:17 +1100 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2017-02-13 13:21:17 +1100 |
commit | ea99441e0da927e5a40cf21311265c7e22974f12 (patch) | |
tree | f824f30ab5f475f0f9b5e8a619a36dc81ea83284 /src/crypto-types-random_source.adb | |
parent | 835c2dffc539e277812925469c82662482e1bbc5 (diff) |
Preference dedupe removed, bignum library obtained from internet (will be replaced later)
Diffstat (limited to 'src/crypto-types-random_source.adb')
-rw-r--r-- | src/crypto-types-random_source.adb | 55 |
1 files changed, 55 insertions, 0 deletions
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; |