refactor gsasl step64 code into separate function