pixiedust 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.0.8 / 2008-05-25
2
+ * Added HashDust.md5_file
3
+
4
+ == 0.0.7 / 2008-05-16
5
+ * Removed a debug routine that was writing to 'pixiedust-attempts.txt'
6
+
1
7
  == 0.0.6 / 2008-05-16
2
8
  * Sped up RandomDust some more, using bit masks for 8 and 16 bit values
3
9
 
data/Manifest.txt CHANGED
@@ -5,3 +5,4 @@ Rakefile
5
5
  lib/pixiedust.rb
6
6
  test/number_dust.rb
7
7
  test/random_dust.rb
8
+ test/hash_dust.rb
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.7'
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.7
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-16 00:00:00 -07:00
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: