ruby hash - 如何在ruby中創建SHA1哈希?




2 Answers

require 'digest/sha1'
Digest::SHA1.hexdigest 'foo'
symbol rails



我創建了一個helper gem ,它是一些sha1代碼的簡單包裝

require 'rickshaw'
> Rickshaw::SHA1.hash('LICENSE.txt')

 => "4659d94e7082a65ca39e7b6725094f08a413250a" 

> "hello world".to_sha1

 => "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed" 



Related


Tags

ruby   hash   sha1