syolorng 2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +3 -0
- data.tar.gz.sig +0 -0
- data/bin/syolorng +19 -0
- data/lib/syolorng.rb +32 -0
- metadata +67 -0
- metadata.gz.sig +1 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a821aab3fea925f4779ec9899317cb1b755141db
|
4
|
+
data.tar.gz: 0628bf53582ac3bd9b562d51a6c39a68c3ef57aa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3cd91d2fae46ea5960b97f4ecc7ebcddfec051831c486f1a9836364f3cf84fe9702722c95bdad5ddf4c2f74d64d4bb294d7070572a5d00a652829718e7106e84
|
7
|
+
data.tar.gz: 904cdb3bfd8b3764085499344bb1d019baf654f2ac11e6cce718920f907060dc3ac8110b9f54d592af76a8d92f4daa58dd5b64ca636cb9ad6f504b520684513e
|
checksums.yaml.gz.sig
ADDED
data.tar.gz.sig
ADDED
Binary file
|
data/bin/syolorng
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'trollop'
|
4
|
+
|
5
|
+
require_relative '../lib/syolorng.rb'
|
6
|
+
|
7
|
+
opts = Trollop::options do
|
8
|
+
version "syolorng v2.0"
|
9
|
+
banner <<-EOS
|
10
|
+
An implementation of the SecureYOLORNG algorithm.
|
11
|
+
|
12
|
+
Usage:
|
13
|
+
syolorng [option]
|
14
|
+
EOS
|
15
|
+
|
16
|
+
opt :max, "Set the maximum value (exclusive)", :type => Integer
|
17
|
+
end
|
18
|
+
|
19
|
+
puts SecureYOLORNG.rand(opts[:max])
|
data/lib/syolorng.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'digest'
|
3
|
+
|
4
|
+
class SecureYOLORNG
|
5
|
+
|
6
|
+
# Return a random integer
|
7
|
+
#
|
8
|
+
# Example:
|
9
|
+
# >> SecureYOLORNG.rand
|
10
|
+
# => 1263245525397660367831872 # Hey! That IS totally random!
|
11
|
+
#
|
12
|
+
# >> SecureYOLORNG.rand 10
|
13
|
+
# => 9
|
14
|
+
#
|
15
|
+
# Arguments:
|
16
|
+
# max: (Integer)
|
17
|
+
|
18
|
+
def self.rand(max=nil)
|
19
|
+
case max
|
20
|
+
when nil
|
21
|
+
random
|
22
|
+
else
|
23
|
+
random % max
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def self.random
|
30
|
+
Digest::SHA512.hexdigest(DateTime::now.to_s).to_i(16)
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: syolorng
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '2.0'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mayeu
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDSDCCAjCgAwIBAgIBATANBgkqhkiG9w0BAQUFADA1MQowCAYDVQQDDAFtMRMw
|
14
|
+
EQYKCZImiZPyLGQBGRYDNng5MRIwEAYKCZImiZPyLGQBGRYCZnIwHhcNMTMwODE1
|
15
|
+
MjIyODQ1WhcNMTQwODE1MjIyODQ1WjA1MQowCAYDVQQDDAFtMRMwEQYKCZImiZPy
|
16
|
+
LGQBGRYDNng5MRIwEAYKCZImiZPyLGQBGRYCZnIwggEiMA0GCSqGSIb3DQEBAQUA
|
17
|
+
A4IBDwAwggEKAoIBAQCwQRiIxDyaa/J4GvB4KVvmXFSmd7oYCtUSZ7gBTOQRXE4p
|
18
|
+
0vd7+wjH70U9xWzuyI9oFwyX6FU+KxUcKCCkAyR2v13s5JucdfAi/TTzQgrLuDgp
|
19
|
+
cU/Eb1rQHTzXCZ/OZ1OjWVdSU+ASIke2bvry+NiN3X9YOirgMZLZq/1yB06l+Jxu
|
20
|
+
Lwy1Daa3aOSzJwiyj9fIZbhKAfF+xeoyvMA5+5FTU2AicbTwQiEvYdHZrdmN6+6B
|
21
|
+
TL2wZArAUyQdrTYhZefexI3vDpI8i32V92ttVjAWwEfc43EDaWvx8TQhu44OGqgu
|
22
|
+
dRuiWoEtX0jRx2HCoEU/dycmH3rdSDT+OqouB77zAgMBAAGjYzBhMAkGA1UdEwQC
|
23
|
+
MAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBTh5W1RNdmHA5zEJ8pwPYISkx/p+jAT
|
24
|
+
BgNVHREEDDAKgQhtQDZ4OS5mcjATBgNVHRIEDDAKgQhtQDZ4OS5mcjANBgkqhkiG
|
25
|
+
9w0BAQUFAAOCAQEAVzMFleZL30edlrMKqV3f87Jd4Kcs1BUH08kOQvnJ0JqA0ryH
|
26
|
+
bYsmGjZInOXRNwwSDjA1zTXK6ZadBFWisKCkvgyA2rPz3ascOTX9Fxf5u1zkpys8
|
27
|
+
vA5y5Iynx53G57/t1fVjyoTknysCyPkZ1OEh9wUfSn4mBswoD82Er9i7kEqDhYMX
|
28
|
+
VtFHaufuPhpjYj5DhZ5VHHpuz4J1fehySI8KJ8eUEsAZmgBPT9H70sg8OttG0MCi
|
29
|
+
gFu3rc3DnKIe/Ul73jXsg2wYjbkPTn6F7AMPO1GaTduYPswaHtv2jSU3uPdln05g
|
30
|
+
WYVkCZvHRzk7c42fWUGxhDbix07DRHIDdifxPA==
|
31
|
+
-----END CERTIFICATE-----
|
32
|
+
date: 2013-08-16 00:00:00.000000000 Z
|
33
|
+
dependencies: []
|
34
|
+
description: A secure, and now futur-proof, random number generator
|
35
|
+
email: m@6x9.fr
|
36
|
+
executables:
|
37
|
+
- syolorng
|
38
|
+
extensions: []
|
39
|
+
extra_rdoc_files: []
|
40
|
+
files:
|
41
|
+
- lib/syolorng.rb
|
42
|
+
- bin/syolorng
|
43
|
+
homepage: https://github.com/Mayeu/SecureYOLORNG
|
44
|
+
licenses:
|
45
|
+
- Public domain
|
46
|
+
metadata: {}
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
requirements: []
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 2.0.2
|
64
|
+
signing_key:
|
65
|
+
specification_version: 4
|
66
|
+
summary: A secure, and now futur-proof, random number generator
|
67
|
+
test_files: []
|
metadata.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
X��@b#����9j���O~��IiT�ɣ���*���@�WA)+�Շ�`���3�6w�h��Z����e9���0pߡx�K���~./�[a�#�c��#���)cn��bl@yT�[6n��IP�3rХe�b���]*��5Y����j�}W�']CD�����0��XG�О/��
|