# HG changeset patch # User Dan # Date 1234818271 18000 # Node ID 79fb483807f64c64a3fa420a007fbf01c55e8233 # Parent 87fcc7175c610aae596ae722f1e0d40e438128e2 Added Unicode support for usernames and passwords (this is probably best considered a JS crypto bug) diff -r 87fcc7175c61 -r 79fb483807f6 includes/clientside/static/crypto.js --- a/includes/clientside/static/crypto.js Mon Feb 16 13:01:35 2009 -0500 +++ b/includes/clientside/static/crypto.js Mon Feb 16 16:04:31 2009 -0500 @@ -1732,66 +1732,6 @@ return unpackBytes(block); } -// This method takes a byte array (byteArray) and converts it to a string by -// applying String.fromCharCode() to each value and concatenating the result. -// The resulting string is returned. Note that this function SKIPS zero bytes -// under the assumption that they are padding added in formatPlaintext(). -// Obviously, do not invoke this method on raw data that can contain zero -// bytes. It is really only appropriate for printable ASCII/Latin-1 -// values. Roll your own function for more robust functionality :) - -function byteArrayToString(byteArray) { - var result = ""; - for(var i=0; i "10ff". The function returns a -// string. - -function byteArrayToHex(byteArray) { - var result = ""; - if (!byteArray) - return; - for (var i=0; i [16, 255]. This -// function returns an array. - -function hexToByteArray(hexString) { - /* - var byteArray = []; - if (hexString.length % 2) // must have even length - return; - if (hexString.indexOf("0x") == 0 || hexString.indexOf("0X") == 0) - hexString = hexString.substring(2); - for (var i = 0; i "10ff". The function returns a +// string. + +function byteArrayToHex(byteArray) { + var result = ""; + if (!byteArray) + return; + for (var i=0; i [16, 255]. This +// function returns an array. + +function hexToByteArray(hexString) { + /* + var byteArray = []; + if (hexString.length % 2) // must have even length + return; + if (hexString.indexOf("0x") == 0 || hexString.indexOf("0X") == 0) + hexString = hexString.substring(2); + for (var i = 0; i