b64.bend checks
raw source on the hub · import 0x0a372da4a053652f70ded7d6e0d19330/b64.bend as B64
ezhttp/b64: Base64 encoding for HTTP credentials (RFC 4648 §4). The
alphabet is the standard table, with = padding. Decoding is not required
for the Authorization helpers.
1 import
import Base
Types
type Phase source · line 7 · raw
Data
how many octets of the current quantum are still missing
Need3Phase
Need2@first:U32 -> Phase
Need1@first:U32 -> @second:U32 -> Phase
Definitions
def b64.table source · line 13 · raw
String
RFC 4648 §4 alphabet, index 0 is A
def b64.char source · line 17 · raw
@m:Maybe<&2, Char> -> Char
the character at a 0..63 index, A when the index is out of the table
def b64.at source · line 25 · raw
@+n:U32 -> Char
one 6-bit value as an alphabet character
def b64.pack source · line 29 · raw
@+a:U32 -> @+b:U32 -> @+c:U32 -> U32
24 bits from three octets
def b64.tail.more source · line 33 · raw
@+n:U32 -> @left:Nat -> String
the last two characters when the quantum was short
def b64.tail source · line 41 · raw
@+n:U32 -> @pad:Nat -> String
four characters from a packed quantum; pad is how many = to write
def b64.quad source · line 49 · raw
@+a:U32 -> @+b:U32 -> @+c:U32 -> @pad:Nat -> String
one quantum as four characters
def b64.end source · line 54 · raw
@phase:Phase -> String
padding for a quantum that ended early
def b64.go source · line 64 · raw
@bs:List<&2, U32> -> @phase:Phase -> String
octets to Base64, three at a time (RFC 4648 §4)
def b64.bytes source · line 78 · raw
@s:String -> List<&2, U32>
code points of a string, one octet each (credentials are ASCII)
def b64.encode source · line 86 · raw
@s:String -> String
Base64 of a string (RFC 4648 §4)