Reading an SSH public key byte by byte
An SSH public key looks like noise, but it is a tiny, regular structure, and reading one by hand takes a minute. Here is one made by ssh-keygen for a throwaway account: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBHDITbwfL74HWVxdOb3me/I4ZgTEoiw+0Qw4DE9VuUa jane@laptop. It has three parts separated by spaces: the key type, the key in Base64, and a comment. The comment is only a label. The middle part is the key.
Decode that Base64 and you get exactly 51 bytes. SSH writes every field as a 4-byte length followed by the bytes. The first four bytes are 00 00 00 0b, which is 11, and the next 11 bytes spell "ssh-ed25519". The type is stored inside the key as well as in front of it, so the key cannot be mistaken for another kind. Then come 00 00 00 20, which is 32, and the 32 bytes of the Ed25519 public key. That is 4 + 11 + 4 + 32 = 51.
This is why every Ed25519 public key begins AAAAC3NzaC1lZDI1NTE5. Base64 spells 3 bytes as 4 characters, and the first 15 bytes, the length and the type name, are the same in every Ed25519 key, so their 20 characters are the same too. RSA keys start AAAAB3NzaC1yc2E for the same reason, with "ssh-rsa" inside. If a key you were sent starts differently, it was damaged in copying, or it is not the kind of key it claims to be.
The fingerprint is the SHA-256 hash of those 51 bytes, written in Base64 with the trailing = removed, and prefixed with "SHA256:". For this key it is SHA256:/RG/jjKDyBkLgg3e/3jtsK+/FroIezRUGDiaKATz0gM, the same value ssh-keygen -l printed for it. Because the hash covers only the 51 bytes, the comment is not part of it. You can rename jane@laptop to anything and the fingerprint stays put. This is the value GitHub shows next to each key in your settings, so it is the quickest way to check which key is which.
The private key file is the same idea, longer. After a fixed "openssh-key-v1" header it records the cipher ("none" here), the public key again, then a private section that starts with two copies of a random check number, then the key type, the public key, 64 bytes of private key (the 32-byte seed followed by the 32-byte public key), the comment, and padding bytes 1, 2, 3 up to a multiple of 8. When a passphrase is set, that private section is what gets encrypted, and the matching check numbers are how ssh knows the passphrase was right.
That last point is the one limit of this page. Encrypting the private section needs bcrypt_pbkdf, which browsers do not offer, so the file is written unencrypted. Save it, run chmod 600, then ssh-keygen -p -f with the file name to add a passphrase. Nothing on this page is stored or sent, so once you close the tab the only copy of the private key is the one you saved.