Recent

Author Topic: True hard random generator  (Read 18184 times)

sam707

  • Guest
Re: True hard random generator
« Reply #15 on: December 22, 2017, 02:31:49 pm »
send me an atmo-spheric noisymodulolorenzbeer, and we'll see  :P
« Last Edit: December 22, 2017, 02:38:37 pm by sam707 »

Thaddy

  • Hero Member
  • *****
  • Posts: 14359
  • Sensorship about opinions does not belong here.
Re: True hard random generator
« Reply #16 on: December 22, 2017, 05:20:00 pm »
@sam707
That's not random. Because it relies on Randomize....... It is a PRNG, a peudo ramdom generator and it has many flaws: there is no entropy, but randomize..... (That s the really moron part (intended, moderators))
And Randomize is not a particular good Random seed....
Do the same tests as I did and published on the wiki. Ignorant. <and grumpy.. >:D >:D >:D >:D >:D>

Test it for yourself: leave out randomize and you have a repeatable PRNG. Checkout the standard code for randomize...

I am busy creating a real randomize...( not accepted yet, but close)


I hope that everyone understands that it is not cryptographically secure in any way.
This is not a case of woof, but bite. (without too much tissue ripped off if you don't move, that is, but only with my Jack Russel hybrids)

Now change subject:
Merry Christmas everybody and every one.... 8-) O:-) O:-) :D :D I will probably have a beer.. (more likely wine from NZ)
« Last Edit: December 22, 2017, 08:10:15 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

sam707

  • Guest
Re: True hard random generator
« Reply #17 on: December 22, 2017, 09:23:40 pm »
@thaddy I WAS EXPECTING with happiness such a crappy reaction from you, tiny whoopy grump  :P :D :D :D :D YOU CAN NOT RESIST HAHAHAHA
go ahead make a random gen with software (ROFL) while it exists on new hardware processors, waste your time as you are so damn used to, while I found solutions that ARE WELL KNOWN to be cryptosecure (cf. blumblum). I've no auction to earn in the fact you can not even read  :D :D :D
as always (at least often), you answer at first in a (minimalist) appropriate way, afterwhat, as a constant, your back to bottles and necks etcaetera
 
blum blum shub is cryptosecure, mersenne twister is not, PCG is "hard to guess" (see table of algos on the wsite)
IKR (as many) they are PRNG with uncongrulethal mechanisms , I also wrote it OMG ask fckdup Santa for glasses! c'mon!
getting old is a wrecking, at least for grumpboats HEHEHE
« Last Edit: December 22, 2017, 09:47:42 pm by sam707 »

sam707

  • Guest
Re: True hard random generator
« Reply #18 on: December 22, 2017, 09:30:13 pm »
OH Finally
I think I just found a real pure random generator = sensors on your motherboard Celsius? Fahrenheit? coolers RPMs? Bipolar cryosystem? HAHAHAAHAHA whileever(!!)
Go Go Go thagryumpiny
it's a constant amazing pleasure to be picked on, by ontop scientisfinistic like ya! tons of universities documents, engineers repports and research papers are sooo wrong when your light (LMAO) apears
 :D
« Last Edit: December 22, 2017, 09:38:36 pm by sam707 »

Sanem

  • Full Member
  • ***
  • Posts: 173
Re: True hard random generator
« Reply #19 on: August 16, 2021, 01:45:31 pm »
@sam707
That's not random. Because it relies on Randomize....... It is a PRNG, a peudo ramdom generator and it has many flaws: there is no entropy, but randomize..... (That s the really moron part (intended, moderators))
And Randomize is not a particular good Random seed....
Do the same tests as I did and published on the wiki. Ignorant. <and grumpy.. >:D >:D >:D >:D >:D>

Test it for yourself: leave out randomize and you have a repeatable PRNG. Checkout the standard code for randomize...

I am busy creating a real randomize...( not accepted yet, but close)


I hope that everyone understands that it is not cryptographically secure in any way.
This is not a case of woof, but bite. (without too much tissue ripped off if you don't move, that is, but only with my Jack Russel hybrids)

Now change subject:
Merry Christmas everybody and every one.... 8-) O:-) O:-) :D :D I will probably have a beer.. (more likely wine from NZ)



Hi Thaddy, You said here you were making a true random, where can I find and use it?
Regards

Bandy

  • New Member
  • *
  • Posts: 35
Re: True hard random generator
« Reply #20 on: August 29, 2021, 07:32:43 pm »
Hello,

When I run this code in Lazarus 2.2.0RC1 Win 32bit is working. When I run the same code in Lazarus 2.2.0RC1 Win 64bit it returns the error in attached picture. What is the solution for the code to work in Win 64 bit, please?

Thank you.

function TryRdRand(out Value: Cardinal): Boolean;
begin
  {$ASMMODE intel}
  asm
  db   $0f
  db   $c7
  db   $f1
  jc   @success
  xor  eax,eax
  ret
  @success:
  mov  [eax],rcx //here is the error in attached picture ONLY in Lazarus 2.2.0RC1 Win 64bit
  mov  eax,1
  end;
end;

procedure TForm1.IntelDrngClick(Sender: TObject);
var
  rnd: Cardinal;
begin
  if TryRdRand(rnd) then
    showmessage(inttostr(rnd));
end;
« Last Edit: August 29, 2021, 07:34:37 pm by Bandy »

mika

  • Full Member
  • ***
  • Posts: 102
Re: True hard random generator
« Reply #21 on: August 29, 2021, 11:14:11 pm »
When I run this code in Lazarus 2.2.0RC1 Win 32bit is working. When I run the same code in Lazarus 2.2.0RC1 Win 64bit it returns the error in attached picture. What is the solution for the code to work in Win 64 bit, please?


Code: Pascal  [Select][+][-]
  1. function TryRdRand(out Value: Cardinal): Boolean; assembler; nostackframe;
  2.   {$ASMMODE intel}
  3.   asm
  4.   mov rdx,value
  5.   rdrand ecx
  6.   jc   @success
  7.   xor  eax,eax
  8.   ret
  9.   @success:
  10.   mov  [rdx],ecx //here is the error in attached picture ONLY in Lazarus 2.2.0RC1 Win 64bit
  11.   mov  eax,1
  12. end;
  13.  

This is for 64 bit mode.
For 32bit win replace rdx with edx.
« Last Edit: August 30, 2021, 07:58:58 am by mika »

Bandy

  • New Member
  • *
  • Posts: 35
Re: True hard random generator
« Reply #22 on: August 31, 2021, 12:45:37 pm »
Thank you, Mika.

Let say I'm sure I have DRNG in my CPU, what is TryRdRand without the Try part?

bytebites

  • Hero Member
  • *****
  • Posts: 639
Re: True hard random generator
« Reply #23 on: August 31, 2021, 01:56:08 pm »
Maybe this complicated?
Code: Pascal  [Select][+][-]
  1. function RdRand: Cardinal;assembler; nostackframe;
  2.   {$ASMMODE intel}
  3. asm
  4.   rdrand eax
  5. end;
  6.  

Bandy

  • New Member
  • *
  • Posts: 35
Re: True hard random generator
« Reply #24 on: August 31, 2021, 02:54:42 pm »
Thank you, bytebites.

For AMD CPU 64bit what is the code for TryRdRand, please?

Bandy

  • New Member
  • *
  • Posts: 35
Re: True hard random generator
« Reply #25 on: August 31, 2021, 04:32:24 pm »
I should change {$ASMMODE intel} to {$ASMMODE amd} ?

bytebites

  • Hero Member
  • *****
  • Posts: 639
Re: True hard random generator
« Reply #26 on: August 31, 2021, 06:59:15 pm »
No. Same code should work on AMD too assuming that rdrand works https://arstechnica.com/gadgets/2019/10/how-a-months-old-amd-microcode-bug-destroyed-my-weekend/

Bandy

  • New Member
  • *
  • Posts: 35
Re: True hard random generator
« Reply #27 on: August 31, 2021, 07:20:23 pm »
Thank you, bytebites.

I don't have AMD CPU.

Bandy

  • New Member
  • *
  • Posts: 35
Re: True hard random generator
« Reply #28 on: August 31, 2021, 07:29:46 pm »
For Android OS, there is a way to use true random number generator? I use the same rdrand instruction?
What is the code for Lazarus 32/64 bit and Android OS?

mas steindorff

  • Hero Member
  • *****
  • Posts: 532
Re: True hard random generator
« Reply #29 on: September 01, 2021, 12:17:22 am »
Android OS is based on Linux so you should try the code from the WIKI
https://wiki.freepascal.org/Dev_random
windows 10 &11, Ubuntu 21+ - fpc 3.0.4, IDE 2.0 general releases

 

TinyPortal © 2005-2018