pixiedust 0.0.7 → 0.0.8
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.
- data/History.txt +6 -0
- data/Manifest.txt +1 -0
- data/lib/pixiedust.rb +14 -1
- data/test/hash_dust.rb +12 -0
- metadata +3 -2
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/lib/pixiedust.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
if RUBY_VERSION && RUBY_VERSION =~ /^1.8/
|
2
|
+
require 'digest'
|
3
|
+
end
|
1
4
|
begin
|
2
5
|
require 'openssl'
|
3
6
|
rescue LoadError
|
@@ -5,7 +8,7 @@ rescue LoadError
|
|
5
8
|
end
|
6
9
|
|
7
10
|
class PixieDust
|
8
|
-
VERSION = '0.0.
|
11
|
+
VERSION = '0.0.8'
|
9
12
|
end
|
10
13
|
|
11
14
|
class Object
|
@@ -16,6 +19,16 @@ class Object
|
|
16
19
|
end
|
17
20
|
end
|
18
21
|
|
22
|
+
class HashDust
|
23
|
+
def HashDust.md5_file(filename)
|
24
|
+
digest = Digest::MD5.new
|
25
|
+
File.open(filename, "rb") { |f|
|
26
|
+
digest.update f.read(32768) until f.eof
|
27
|
+
}
|
28
|
+
return digest.hexdigest
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
19
32
|
class RandomDust
|
20
33
|
# XXX: Do something to make sure that OpenSSL is using a real RNG
|
21
34
|
def between(min, max)
|
data/test/hash_dust.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'spec'
|
3
|
+
|
4
|
+
require "#{File.dirname(__FILE__)}/../lib/pixiedust"
|
5
|
+
|
6
|
+
describe HashDust do
|
7
|
+
it "Should get the same value as command line md5sum" do
|
8
|
+
md5sum = `md5sum #{__FILE__} | cut -f 1 -d ' '`.strip
|
9
|
+
HashDust.md5_file(__FILE__).should == md5sum
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pixiedust
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Wilkins
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-05-
|
12
|
+
date: 2008-05-25 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -39,6 +39,7 @@ files:
|
|
39
39
|
- lib/pixiedust.rb
|
40
40
|
- test/number_dust.rb
|
41
41
|
- test/random_dust.rb
|
42
|
+
- test/hash_dust.rb
|
42
43
|
has_rdoc: true
|
43
44
|
homepage: " by Jonathan Wilkins"
|
44
45
|
post_install_message:
|