Use Data::Entropy for randomness (see #19)
This commit is contained in:
		
							parent
							
								
									f94ae4348b
								
							
						
					
					
						commit
						9e55797c19
					
				
							
								
								
									
										1
									
								
								cpanfile
								
								
								
								
							
							
						
						
									
										1
									
								
								cpanfile
								
								
								
								
							| 
						 | 
				
			
			@ -12,3 +12,4 @@ requires 'Email::Valid';
 | 
			
		|||
requires 'Number::Bytes::Human';
 | 
			
		||||
requires 'Filesys::DfPortable';
 | 
			
		||||
requires 'Switch';
 | 
			
		||||
requires 'Data::Entropy';
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,6 +29,13 @@ DISTRIBUTIONS
 | 
			
		|||
      Canary::Stability 2006
 | 
			
		||||
    requirements:
 | 
			
		||||
      ExtUtils::MakeMaker 0
 | 
			
		||||
  Crypt-Rijndael-1.13
 | 
			
		||||
    pathname: L/LE/LEONT/Crypt-Rijndael-1.13.tar.gz
 | 
			
		||||
    provides:
 | 
			
		||||
      Crypt::Rijndael 1.13
 | 
			
		||||
    requirements:
 | 
			
		||||
      ExtUtils::MakeMaker 0
 | 
			
		||||
      perl 5.006
 | 
			
		||||
  DBD-SQLite-1.48
 | 
			
		||||
    pathname: I/IS/ISHIGAKI/DBD-SQLite-1.48.tar.gz
 | 
			
		||||
    provides:
 | 
			
		||||
| 
						 | 
				
			
			@ -144,6 +151,48 @@ DISTRIBUTIONS
 | 
			
		|||
      ExtUtils::MakeMaker 6.48
 | 
			
		||||
      Test::Simple 0.90
 | 
			
		||||
      perl 5.008
 | 
			
		||||
  Data-Entropy-0.007
 | 
			
		||||
    pathname: Z/ZE/ZEFRAM/Data-Entropy-0.007.tar.gz
 | 
			
		||||
    provides:
 | 
			
		||||
      Data::Entropy 0.007
 | 
			
		||||
      Data::Entropy::Algorithms 0.007
 | 
			
		||||
      Data::Entropy::RawSource::CryptCounter 0.007
 | 
			
		||||
      Data::Entropy::RawSource::Local 0.007
 | 
			
		||||
      Data::Entropy::RawSource::RandomOrg 0.007
 | 
			
		||||
      Data::Entropy::RawSource::RandomnumbersInfo 0.007
 | 
			
		||||
      Data::Entropy::Source 0.007
 | 
			
		||||
    requirements:
 | 
			
		||||
      Carp 0
 | 
			
		||||
      Crypt::Rijndael 0
 | 
			
		||||
      Data::Float 0.008
 | 
			
		||||
      Errno 1.00
 | 
			
		||||
      Exporter 0
 | 
			
		||||
      HTTP::Lite 2.2
 | 
			
		||||
      IO::File 1.03
 | 
			
		||||
      Module::Build 0
 | 
			
		||||
      Params::Classify 0
 | 
			
		||||
      Test::More 0
 | 
			
		||||
      constant 0
 | 
			
		||||
      integer 0
 | 
			
		||||
      parent 0
 | 
			
		||||
      perl 5.006
 | 
			
		||||
      strict 0
 | 
			
		||||
      warnings 0
 | 
			
		||||
  Data-Float-0.012
 | 
			
		||||
    pathname: Z/ZE/ZEFRAM/Data-Float-0.012.tar.gz
 | 
			
		||||
    provides:
 | 
			
		||||
      Data::Float 0.012
 | 
			
		||||
    requirements:
 | 
			
		||||
      Carp 0
 | 
			
		||||
      Exporter 0
 | 
			
		||||
      Module::Build 0
 | 
			
		||||
      Test::More 0
 | 
			
		||||
      constant 0
 | 
			
		||||
      integer 0
 | 
			
		||||
      parent 0
 | 
			
		||||
      perl 5.006
 | 
			
		||||
      strict 0
 | 
			
		||||
      warnings 0
 | 
			
		||||
  EV-4.21
 | 
			
		||||
    pathname: M/ML/MLEHMANN/EV-4.21.tar.gz
 | 
			
		||||
    provides:
 | 
			
		||||
| 
						 | 
				
			
			@ -200,6 +249,17 @@ DISTRIBUTIONS
 | 
			
		|||
      File::Temp 0
 | 
			
		||||
      Test::More 0
 | 
			
		||||
      Test::Warn 0
 | 
			
		||||
  HTTP-Lite-2.44
 | 
			
		||||
    pathname: N/NE/NEILB/HTTP-Lite-2.44.tar.gz
 | 
			
		||||
    provides:
 | 
			
		||||
      HTTP::Lite 2.44
 | 
			
		||||
    requirements:
 | 
			
		||||
      ExtUtils::MakeMaker 0
 | 
			
		||||
      Fcntl 0
 | 
			
		||||
      Socket 1.3
 | 
			
		||||
      perl 5.005
 | 
			
		||||
      strict 0
 | 
			
		||||
      warnings 0
 | 
			
		||||
  IPC-Run3-0.048
 | 
			
		||||
    pathname: R/RJ/RJBS/IPC-Run3-0.048.tar.gz
 | 
			
		||||
    provides:
 | 
			
		||||
| 
						 | 
				
			
			@ -535,6 +595,20 @@ DISTRIBUTIONS
 | 
			
		|||
      Test::More 0.47
 | 
			
		||||
      Test::Script 1.06
 | 
			
		||||
      perl 5.006
 | 
			
		||||
  Params-Classify-0.013
 | 
			
		||||
    pathname: Z/ZE/ZEFRAM/Params-Classify-0.013.tar.gz
 | 
			
		||||
    provides:
 | 
			
		||||
      Params::Classify 0.013
 | 
			
		||||
    requirements:
 | 
			
		||||
      Exporter 0
 | 
			
		||||
      ExtUtils::ParseXS 2.2006
 | 
			
		||||
      Module::Build 0
 | 
			
		||||
      Scalar::Util 1.01
 | 
			
		||||
      Test::More 0
 | 
			
		||||
      parent 0
 | 
			
		||||
      perl 5.006001
 | 
			
		||||
      strict 0
 | 
			
		||||
      warnings 0
 | 
			
		||||
  Params-Util-1.07
 | 
			
		||||
    pathname: A/AD/ADAMK/Params-Util-1.07.tar.gz
 | 
			
		||||
    provides:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,7 @@
 | 
			
		|||
package Lufi;
 | 
			
		||||
use Mojo::Base 'Mojolicious';
 | 
			
		||||
use LufiDB;
 | 
			
		||||
use Data::Entropy qw(entropy_source);
 | 
			
		||||
 | 
			
		||||
$ENV{MOJO_MAX_WEBSOCKET_SIZE} = 100485760; # 10 * 1024 * 1024 = 10MiB
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -101,7 +102,7 @@ sub startup {
 | 
			
		|||
            my @chars  = ('a'..'z','A'..'Z','0'..'9', '-', '_');
 | 
			
		||||
            my $result = '';
 | 
			
		||||
            foreach (1..$length) {
 | 
			
		||||
                $result .= $chars[rand scalar(@chars)];
 | 
			
		||||
                $result .= $chars[entropy_source->get_int(scalar(@chars))];
 | 
			
		||||
            }
 | 
			
		||||
            return $result;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue