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

Method hash_message

python/ccxt/async_support/lighter.py:573–579  ·  view source on GitHub ↗
(self, message: str)

Source from the content-addressed store, hash-verified

571 return r
572
573 def hash_message(self, message: str):
574 binaryMessage = self.encode(message)
575 binaryMessageLength = self.binary_length(binaryMessage)
576 x19 = self.base16_to_binary('19')
577 newline = self.base16_to_binary('0a')
578 prefix = self.binary_concat(x19, self.encode('Ethereum Signed Message:'), newline, self.encode(self.number_to_string(binaryMessageLength)))
579 return '0x' + self.hash(self.binary_concat(prefix, binaryMessage), 'keccak', 'hex')
580
581 def sign_hash(self, hash, privateKey):
582 self.check_required_credentials()

Callers 1

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