Skip to content

Instantly share code, notes, and snippets.

@kochd
Created February 26, 2016 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kochd/d20158c88afb6fc72628 to your computer and use it in GitHub Desktop.
Save kochd/d20158c88afb6fc72628 to your computer and use it in GitHub Desktop.
loop do
length = rand(1..(1024**3))
puts "Writing #{length} bytes"
data = Random.new.bytes(length)
file = "rand_data_#{SecureRandom.hex(32)}"
File.open(file, "w") { |f| f.write data}
a = Digest::SHA512.hexdigest(File.read(file))
b = Digest::SHA512.hexdigest(data)
fail "Missmatch" unless a == b
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment