* Split SQL into functions and setup. * Remove hash-lib dependency. * Makes code into Postgresql extension.