1) About the ed25519 public key, and how it is in bytes:
From [1]:
Ed25519 keys start life as a 32-byte (256-bit) uniformly random binary seed (e.g. the output of SHA256 on some random input). The seed is then hashed using SHA512, which gets you 64 bytes (512 bits), which is then split into a “left half” (the first 32 bytes) and a “right half”. The left half is massaged into a curve25519 private scalar “a” by setting and clearing a few high/low-order bits. The pubkey is generated by multiplying this secret scalar by “B” (the generator), which yields a 32-byte/256-bit group element “A”.
To convert it to this String format you need to split it to 6 bit chars as per the Base64 format transformation.
Based on this Q/A (see: [2]), the public 32 bytes / 256 bit key should be 51 bytes or in Base64 format 68 characters.
Your key example seems to have 54 chars, which seems weird, because it is none of the above.
(I modified it to slots of 5 x 10 + 1 x 4)
edpktieBMr R9Df3dqzZA JpDZBXb1h1 88fyrQyRJc m5RH2WpbvM VR8b
That reveals Tezos have different encoding: Base58. That was mentioned in your original link:
contracts, addresses, keys and signatures are written as strings, in their usual Base58 encoded versions (readable), or as their raw bytes (optimized).
To decode, there was a python call base58check.b58decode
in the FLF OCP's answer link content.
2) signature and key_hash
signatures are also base58. (see 1)
I found about key_hash
that it is its own datatype in Tezos (one of the few ones) and it is used like this:
We can combine those atomic types to build more complex types using constructors. For instance pair int string represents a pair of two value, an integer, and a string, or signature string represents a value that is either a signature or a string, list timestamp a list of time-stamps, and map key_hash
nat is the type of an associative map between the hash of a public key and a positive integer.
Other types:
timestamp: Dates in the real world.
mutez: A specific type for manipulating tokens.
contract 'param: A contract, with the type of its code.
address: An untyped contract address.
operation: An internal operation emitted by a contract.
key: A public cryptography key.
key_hash: The hash of a public cryptography key.
signature: A cryptographic signature.
3) About key hash formation:
I did not found more than the usage of it and the fact it is a native type in Tezos.
My Sources:
[1] https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/
[2] https://crypto.stackexchange.com/questions/44584/ed25519-ssh-public-key-is-always-80-characters-long
[3] https://hackernoon.com/hash-consing-in-tezos-e4a59eeea5cd