MCPcopy Create free account
hub / github.com/ccxt/ccxt / hash_message

Method hash_message

python/ccxt/derive.py:1131–1137  ·  view source on GitHub ↗
(self, message)

Source from the content-addressed store, hash-verified

1129 return self.sign_hash(hashOrder[-64:], privateKey[-64:])
1130
1131 def hash_message(self, message):
1132 binaryMessage = self.encode(message)
1133 binaryMessageLength = self.binary_length(binaryMessage)
1134 x19 = self.base16_to_binary('19')
1135 newline = self.base16_to_binary('0a')
1136 prefix = self.binary_concat(x19, self.encode('Ethereum Signed Message:'), newline, self.encode((self.number_to_string(binaryMessageLength))))
1137 return '0x' + self.hash(self.binary_concat(prefix, binaryMessage), 'keccak', 'hex')
1138
1139 def sign_hash(self, hash, privateKey):
1140 self.check_required_credentials()

Callers 1

sign_messageMethod · 0.95

Calls 5

binary_lengthMethod · 0.80
base16_to_binaryMethod · 0.80
binary_concatMethod · 0.80
encodeMethod · 0.45
hashMethod · 0.45

Tested by

no test coverage detected