From 5e88923de45e81fdb29b6b2c3b4e2a9d1fdf91cf Mon Sep 17 00:00:00 2001 From: sikofitt Date: Wed, 4 May 2016 11:02:09 -0700 Subject: [PATCH] Foobar --- Renegade.Random.BSDRandom.pas | 8 +++++++- Renegade.Random.Generic.pas | 2 +- Renegade.Random.RandomInterface.pas | 2 +- Renegade.Random.URandom.pas | 1 - Renegade.Random.pas | 2 +- tests/RandomTest.pas | 2 -- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Renegade.Random.BSDRandom.pas b/Renegade.Random.BSDRandom.pas index 33e7b30..339f4bd 100644 --- a/Renegade.Random.BSDRandom.pas +++ b/Renegade.Random.BSDRandom.pas @@ -13,7 +13,7 @@ { Foundation, either version 3 of the License, or } { (at your option) any later version. } { } -{ Foobar is distributed in the hope that it will be } +{ Renegade is distributed in the hope that it will be } { useful, but WITHOUT ANY WARRANTY; without even the } { implied warranty of MERCHANTABILITY or FITNESS FOR } { A PARTICULAR PURPOSE. See the GNU General Public } @@ -40,6 +40,7 @@ Unit Renegade.Random.BSDRandom; interface uses + CTypes, Objects, Classes, SysUtils, @@ -49,11 +50,16 @@ uses type PBSDRandom = ^BSDRandom; BSDRandom = class (RandomTrait, RandomInterface) + private + function GetSystemBytes(var RandomByteBuffer : TBytes; NBytes : SizeUint) : CInt; public function GetBytes(NBytes : SizeUInt) : TBytes; function GetString(NBytes : SizeUInt) : AnsiString; end; +procedure arc4random_buf(var Buffer : PCChar; StringLength : SizeInt); + cdecl;varargs;external 'c' name 'arc4random_buf'; + implementation diff --git a/Renegade.Random.Generic.pas b/Renegade.Random.Generic.pas index 7302a3a..7ae9292 100644 --- a/Renegade.Random.Generic.pas +++ b/Renegade.Random.Generic.pas @@ -13,7 +13,7 @@ { Foundation, either version 3 of the License, or } { (at your option) any later version. } { } -{ Foobar is distributed in the hope that it will be } +{ Renegade is distributed in the hope that it will be } { useful, but WITHOUT ANY WARRANTY; without even the } { implied warranty of MERCHANTABILITY or FITNESS FOR } { A PARTICULAR PURPOSE. See the GNU General Public } diff --git a/Renegade.Random.RandomInterface.pas b/Renegade.Random.RandomInterface.pas index b112828..a9d8a12 100644 --- a/Renegade.Random.RandomInterface.pas +++ b/Renegade.Random.RandomInterface.pas @@ -13,7 +13,7 @@ { Foundation, either version 3 of the License, or } { (at your option) any later version. } { } -{ Foobar is distributed in the hope that it will be } +{ Renegade is distributed in the hope that it will be } { useful, but WITHOUT ANY WARRANTY; without even the } { implied warranty of MERCHANTABILITY or FITNESS FOR } { A PARTICULAR PURPOSE. See the GNU General Public } diff --git a/Renegade.Random.URandom.pas b/Renegade.Random.URandom.pas index e8905b7..86da530 100644 --- a/Renegade.Random.URandom.pas +++ b/Renegade.Random.URandom.pas @@ -71,7 +71,6 @@ var RandomCharBuffer : PCChar; Return : CInt; begin - Writeln(SYS_getrandom); GetMem(RandomCharBuffer, NBytes); Return := syscall(SYS_getrandom, @RandomCharBuffer^, NBytes, GRND_DEFAULT); Move(RandomCharBuffer[0], RandomByteBuffer[0], NBytes); diff --git a/Renegade.Random.pas b/Renegade.Random.pas index 06fbac7..5dbcb0f 100644 --- a/Renegade.Random.pas +++ b/Renegade.Random.pas @@ -13,7 +13,7 @@ { Foundation, either version 3 of the License, or } { (at your option) any later version. } { } -{ Foobar is distributed in the hope that it will be } +{ Renegade is distributed in the hope that it will be } { useful, but WITHOUT ANY WARRANTY; without even the } { implied warranty of MERCHANTABILITY or FITNESS FOR } { A PARTICULAR PURPOSE. See the GNU General Public } diff --git a/tests/RandomTest.pas b/tests/RandomTest.pas index f2c36b5..7189db9 100644 --- a/tests/RandomTest.pas +++ b/tests/RandomTest.pas @@ -24,8 +24,6 @@ begin Assert(RRandom.InheritsFrom(RandomTrait)); S := RRandom.GetString(22); T := RRandom.GetBytes(22); - Writeln(S); - Writeln(Length(S)); Assert(Length(S) = 22); Assert(High(S) = 22); Assert(Low(S) = 1);