若是你但願立刻開始學習以太坊DApp開發,能夠訪問匯智網提供的出色的在線互動教程:web
使用keccak-256哈希算法,計算給定字符串的哈希值。算法
調用:學習
web3.sha3(string, options)
參數:.net
string
·: String - 傳入的須要使用Keccak-256 SHA3算法進行哈希運算的字符串。options
: Object - 可選項設置。若是要解析的是hex格式的十六進制字符串。須要設置encoding爲hex。由於JS中會默認忽略0x。返回值:3d
String
- 使用Keccak-256 SHA3算法哈希過的結果。示例:code
//省略初始化過程 var hash = web3.sha3("Some string to be hashed"); console.log(hash); var hashOfHash = web3.sha3(hash, {encoding: 'hex'}); console.log(hashOfHash);
以太坊開發入門教程blog