Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Keccak-256 hashing utilities
import Voltaire // From string let h1 = Keccak256.hash("hello world") print(h1.hex) // From bytes let input: [UInt8] = [1, 2, 3] let h2 = Keccak256.hash(input) // From Data import Foundation let data = Data([0xde, 0xad, 0xbe, 0xef]) let h3 = Keccak256.hash(data) // All return Hash XCTAssertEqual(h1.hex.count, 66) // 0x + 64 hex
// EIP-191: "\u{0019}Ethereum Signed Message:\n" + len(message) + message let m1 = Keccak256.hashEthereumMessage("hello world") let m2 = Keccak256.hashEthereumMessage([UInt8]("hello world".utf8)) let m3 = Keccak256.hashEthereumMessage(Data("hello world".utf8)) XCTAssertEqual(m1, m2) XCTAssertEqual(m2, m3)
Was this page helpful?
Suggestions