liveBook · Manning

Base64

As explained in Grokking Relational Database Design

Base64 is an encoding standard that represents binary data as ASCII characters.

Base64 encodes binary data as ASCII characters so applications can store values that are difficult to print. In password storage, it can represent a binary hash as a character string suitable for a CHAR column. section 7.4

Encoding a password hash

A bcrypt hash may produce 40 bytes of binary data. Base64 encoding expands that value to 60 bytes, so the password column should use CHAR(60) rather than VARCHAR(20). section 7.4

How Grokking Relational Database Design covers it

How deep it goes
Explains the encoding purpose and resulting length, but does not detail Base64’s conversion algorithm.
Examples
Uses a 40-byte bcrypt result encoded into 60 bytes and stored in CHAR(60).
What it assumes
Assumes familiarity with database columns but introduces binary hashes and ASCII encoding in the password-storage context.
What you can do after
Apply Base64 when storing binary hash output in a character column and resize the password column accordingly.
How it connects
Connects Base64 with hashing, bcrypt, PBKDF2, SHA-512, passwords, and the CHAR data type.

Also explained in

Compare how 7 books explain Base64 →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Relational Database Design. The section links point to the parts of the book it draws on.