ported the wcr_encrypt function

- this wasn't tested because I needed to search for a substitute for
randfunc in javascript