mirror of
https://github.com/luxfi/safe-ios.git
synced 2026-10-30 15:19:20 +00:00
23 lines
445 B
Swift
23 lines
445 B
Swift
//
|
|
// EthHasher.swift
|
|
// Multisig
|
|
//
|
|
// Created by Dmitry Bespalov on 04.05.20.
|
|
// Copyright © 2020 Gnosis Ltd. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import CryptoSwift
|
|
|
|
struct EthHasher {
|
|
|
|
static func hash(_ msg: Data) -> Data {
|
|
let result = SHA3(variant: .keccak256).calculate(for: Array(msg))
|
|
return Data(result)
|
|
}
|
|
|
|
static func hash(_ msg: String) -> Data {
|
|
hash(msg.data(using: .utf8)!)
|
|
}
|
|
}
|