Skip to content
This repository has been archived by the owner on Nov 27, 2021. It is now read-only.

Commit

Permalink
updated formatting and links
Browse files Browse the repository at this point in the history
  • Loading branch information
ipopescu committed Nov 11, 2021
1 parent 86ba41f commit 5c31532
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions implementation/checksummed-hex.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,39 +31,36 @@ The following `keys </implementation/serialization-standard.html#serialization-f
Implementation
--------------

At a high level, the current implementation follows the steps below. The implementation was
declared in :ref:`cep-57 <https://github.com/casper-network/ceps/blob/master/text/0057-checksummed-addresses.md>` and implemented in **version**.
The actual implementation is hosted on github :ref:`here <https://github.com/casper-network/casper-node/blob/dev/types/src/checksummed_hex.rs>`.
At a high level, the implementation in `GitHub <https://github.com/casper-network/casper-node/blob/dev/types/src/checksummed_hex.rs>`_ follows the steps below. The implementation was
declared in `CEP-57 <https://github.com/casper-network/ceps/blob/master/text/0057-checksummed-addresses.md>`_ and implemented in **version**.

1. Take a blake2b hash of the input bytes.
2. Convert the hash bytes into a cyclical stream of bits.
3. Convert the input bytes into an array of nibbles.
4. For each nibble, if the nibble is greater than ``10``, meaning it's an
alphabetical character ``a`` through ``f``, check the next bit in the stream of hash bits.
4. For each nibble, if the nibble is greater than ``10``, meaning it's an alphabetical character ``a`` through ``f``, check the next bit in the stream of hash bits.
5. If the bit is ``1``, capitalize the character.



.. _checksum-hex-public-key-encoding:

How ed25519 and secp256k1 keys are encoded
------------------------------------------
How `ed25519` and `secp256k1` keys are encoded
----------------------------------------------

For ed25519 and secp256k1 public keys, the public key bytes are hex encoded with an embedded
checksum, then the hex encoded public key tag is concatenated to the beginning of the encoded
For `ed25519` and `secp256k1` public keys, the public key bytes are hex-encoded with an embedded
checksum, then the hex-encoded public key tag is concatenated to the beginning of the encoded
public key.

**Example**
For the ed25519 public key ``01ccDBB42854759141910c134D67cfAf0E78a93AdD396d43045fAa3A567DcABd84``, the encoded public key
``ccDBB42854759141910c134D67cfAf0E78a93AdD396d43045fAa3A567DcABd84`` is concatenated with the key tag for ed25519 public keys ``01``.
**Example**:

You can find the implementation on github **link**
For the ed25519 public key ``01ccDBB42854759141910c134D67cfAf0E78a93AdD396d43045fAa3A567DcABd84``, the encoded public key ``ccDBB42854759141910c134D67cfAf0E78a93AdD396d43045fAa3A567DcABd84`` is concatenated with the key tag for ed25519 public keys ``01``.

You can find the implementation on GitHub **link**.

.. _checksum-hex-backward-compatibility:

Backward Compatibility
----------------------

.. TODO: Update this with whichever version this ships with.
Version **1.x.x** is backwards-compatible with lower-hex encoded keys, so if you use a public key that is encoded in lowercase hex,
the network will still be able to decode the public key and use it in a transaction.
Version 1.x.x is backward-compatible with lower-hex encoded keys, so if you use a public key encoded in lowercase hex, the network will still be able to decode the public key and use it in a transaction.

0 comments on commit 5c31532

Please sign in to comment.