0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Crystalで文字列のmd5sumを求める

Posted at

Crystal1.2.2の公式ドキュメントを見ると、

こんな感じで書いてあってどうすればよいかよくわからない。

OpenSSL::MD5 とかもあるし、さらに古いドキュメントだと Crypto::MD5 みたいのもあったりする。しかし、実際には、普通に hexdigest メソッドが使えるので、下記のようにするだけでいい。

require "digest/md5"

p Digest::MD5.hexdigest("hoge")
# => "a4b1b42ffe743732a437b6c1e2a16106"

この記事は以上です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?