misiek <michaelaugustyniak / gazeta.pl> writes:

> hi
>
> I need to generate a hash like
>
> np = Digest::MD5.new
> np << "hello"
> require 'base64'
> md5_np = "{MD5}" << Base64.b64encode(np.digest) # =>
> "XUFAKrxLKna5cZ2REBfFkg==\n"
>
> but it will generate hash from 'hello' word I need generate like random hash
>
> how to do it ?

[~]0% ruby -rdigest/md5 -rbase64 -e '5.times {Base64.b64encode(Digest::MD5.digest(rand.to_s))}'
+BY/FhdFGehihHteFngcYA==
2s+T0TuN42QSHvHgPAmZ7w==
rlRXgFfVGQHj67XytaQSGA==
RnEqIK+mIxTvfuSh22ZfKw==
nM3iMmxfHuu8IyCDpUexSg==

Steve