Mukesh
Mukesh

Reputation: 1267

ASCII SHA1 Hash Ruby

I want to generate ASCII SHA1 Hash of a string comprised of the current time (to millisecond) and a salt string (can be anything)

Does someone know how to implement such thing?

Upvotes: 1

Views: 143

Answers (1)

Shawn Balestracci
Shawn Balestracci

Reputation: 7540

require 'digest'
salt="Celtic Sea"
time_now = Time.now
Digest::SHA1.hexdigest("%.3f#{salt}" % time_now)

Upvotes: 4

Related Questions