Data::...ndomOrg(3pm)

πŸ’– Data::Entropy::RawSource::RandomOrg πŸ’–

okay bestie, so this is a page from the User Contributed Perl Documentation, and it's literally all about Data::Entropy::RawSource::RandomOrg β€” downloading entropy straight from random.org. yes. actual random. from the sky. (well, from a server. same vibe.) πŸŽ€


✨ NAME ✨

Data::Entropy::RawSource::RandomOrg β€” download entropy from random.org 🌈


🌸 SYNOPSIS 🌸

use Data::Entropy::RawSource::RandomOrg;

my $rawsrc = Data::Entropy::RawSource::RandomOrg->new;

$c = $rawsrc->getc;
# and the rest of the I/O handle interface

that's it, that's the whole vibe. you make the thing, you read octets off it like any other handle, periodt. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So this class hands you an I/O handle that's connected to a stream of random octets, and those octets are being generated by an electromagnetic noise detector that's hooked up to the random.org server. πŸ’– It's a genuinely strong source of random bits β€” like, no cap, the randomness is real β€” but it is not suitable for security applications, because the bits get passed over the Internet unencrypted. 😭 The handle implements a substantial subset of the interface described in IO::Handle.

If you want to use this as a general entropy source, the recommended move is to wrap an object of this class using Data::Entropy::Source, which gives you methods to extract entropy in way more convenient forms than just plain octets. 🫢

Now here's the tea on the bits themselves: the bits generated at random.org are, theoretically and as far as anyone can tell, totally unbiased and uncorrelated. ✨ Iconic. BUT β€” they're sent over the Internet in the clear, so they're subject to interception and alteration by an adversary. πŸ™ˆ Which means this is generally unsuitable for security applications. Also, the capacity of the random bit server is limited. This class will slow down requests if the server's entropy pool is less than half full, and (as requested by the server operators) it will pause entirely if the entropy pool is less than 20% full. 😭

So who should use what:

  • Apps that need secret entropy β†’ generate it locally, see Data::Entropy::RawSource::Local πŸ’œ
  • Apps that need a large amount of entropy β†’ generate it locally, or download it from randomnumbers.info, see Data::Entropy::RawSource::RandomnumbersInfo 🌸
  • Apps that need a large amount of apparently-random data but not true entropy β†’ maybe just fake it cryptographically, see Data::Entropy::RawSource::CryptCounter πŸ’…

πŸŽ€ CONSTRUCTOR πŸŽ€

  • Data::Entropy::RawSource::RandomOrg->new β€” creates and returns a handle object referring to a stream of random octets generated by random.org. πŸ¦‹

⭐ METHODS ⭐

A subset of the interfaces described in IO::Handle and IO::Seekable are provided:

  • $rawsrc->read(BUFFER, LENGTH[, OFFSET])
  • $rawsrc->getc
  • $rawsrc->ungetc(ORD)
  • $rawsrc->eof

Buffered reading from the source, as in IO::Handle. πŸ’–

  • $rawsrc->sysread(BUFFER, LENGTH[, OFFSET]) β€” unbuffered reading from the source, as in IO::Handle. πŸ”₯
  • $rawsrc->close β€” does nothing. literally nothing. it's giving ✨minimal effort✨ πŸŽ€
  • $rawsrc->opened β€” retruns true to indicate that the source is available for I/O. πŸ‘‘ (yes, "retruns". we're keeping it. iconic typo behaviour.)
  • $rawsrc->clearerr
  • $rawsrc->error

Error handling, as in IO::Handle. πŸ’œ

The buffered (read et al) and unbuffered (sysread et al) sets of methods are interchangeable, because no such distinction is made by this class. 🫢

Methods to write to the file are unimplemented, because the stream is fundamentally read-only. 🚫✍️ Methods to seek are unimplemented, because the stream is non-rewindable. ungetc works, however. πŸ’…

no take-backsies on the whole stream, bestie. you get one pass. but ungetc still ate. 😌

🌈 SEE ALSO 🌈

  • Data::Entropy::RawSource::CryptCounter
  • Data::Entropy::RawSource::Local
  • Data::Entropy::RawSource::RandomnumbersInfo
  • Data::Entropy::Source
  • <http://www.random.org>

πŸ‘‘ AUTHOR πŸ‘‘

Andrew Main (Zefram) <zefram@fysh.org>

Maintained by Robert Rothenberg <rrwo@cpan.org>


Copyright (C) 2006, 2007, 2009, 2011, 2025 Andrew Main (Zefram) <zefram@fysh.org>


πŸŽ€ LICENSE πŸŽ€

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. ✨


and that's the whole page, bestie!! 🫢 this was perl v5.40.1, dated 2025-03-29, from Data::...ndomOrg(3pm) β€” go forth and read your octets responsibly (and locally, if it's for security, fr fr) πŸ’–πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from