Proquint
Proquint.Proquint — ModuleProquints: Identifiers that are Readable, Spellable, and Pronounceable
This is a Julia implementation of Wilkerson's proquints described in his article http://arXiv.org/html/0901.4016.
In short 16 bits get represented in a "proquint" as alternating consonants and vowels.
Four-bits as a consonant:
0 1 2 3 4 5 6 7 8 9 A B C D E F
b d f g h j k l m n p r s t v zTwo-bits as a vowel:
0 1 2 3
a i o uWhole 16-bit word, where "con" = consonant, "vo" = vowel:
0 1 2 3 4 5 6 7 8 9 A B C D E F
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|con |vo |con |vo |con |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Proquints are separated by dashes -.
Short Form (extension)
The short form does not encode leading zeros of 16-bit words and if an entire word is 0, it gets encoded as "x".
Example
The UInt32 0x0a484904 is in bit representation:
0000 10 1001 00 1000 0100 10 0100 00 0100
b o n a m - h o h a h
o n a m - h o h a h # short versionThe IP address 127.0.0.1 is a 0x7f000001 UInt32:
0111 11 1100 00 0000 0000 00 0000 00 0001
l u s a b - b a b a d
l u s a b - d # short versionProquints are unambiguous and can be generated from integers and converted back to them:
julia> using Proquint
julia> uint2quint(0x7f000001)
"lusab-babad"
julia> uint2quint(0x7f000001, short=true) # this gives the short version
"lusab-d"
julia> quint2uint("lusab-babad", UInt32)
0x7f000001
julia> quint2uint("lusab-d", UInt32)
0x7f000001Proquint.version — ConstantGives the package version
Proquint.quint2uint — Methodquint2uint(qs::String, U::Type{T}=UInt) where T<:UnsignedConvert a proquint string identifier qs into a corresponding integer value.
Arguments
U: unsigned integer type e.g.UInt16,UInt32,UInt64orUInt128
Example
julia> quint2uint("lusab-babad", UInt32)
0x7f000001
julia> quint2uint("lusab-d", UInt32)
0x7f000001Proquint.uint2quint — Methoduint2quint(x::T, sep="-"; short=false) where T<:IntegerConvert an integer value into a corresponding proquint string identifier.
Arguments
x: an integer argument,sep="-": a separator string,short=false: determines whether a short string should be created.
Example
julia> uint2quint(0x7f000001)
"lusab-babad"
julia> uint2quint(0x7f000001, short=true)
"lusab-d"