|
LibraryReference
A brief introduction to how to use the Passpack Host-Proof Hosting JS Library
InstallationSimply, put the following line into your HTML code: <script type="text/javascript" src="passpack.js"></script> ReferencePasspack.encode(algorithm,plaintext[,key,optionalPars])To encode the string str with the key mykey using AES 256-bit use: Passpack.encode("AES",str,mykey) By default the result of the encryption is Base64-encoded. To change the default settings you can use optionalPars. They must be as the following: {
nbits: 128,
escape: true
}For example, to encode the string str using AES 192-bit, without Base64 encoding you have to run: Passpack.encode("AES",str,mykey,{
nbits: 192,
noBase64: true
});Supported algorithms:
Optional parameters:
Passpack.UTF8 and Passpack.Base64 are based on Utf8 and Base64 scripts by WebToolkit. Passpack.AES and Passpack.xxTEA are based on Chris Veness's AES and BlockTEA implementations. Passpack.decode(algorithm,plaintext[,key,optionalPars])Works similar to encode with the same Optional pars, except:
Passpack.JSON.parse(jsonString)The Passpack.JSON static object is a variation of the Douglas Crockford JSON object defined in json2.js library. In addition to the original method, the parse method adds automatic conversion of date strings from the ISO format into Date objects. To parse a JSON string: Passpack.JSON.parse(jsonStr); If you are considering developing a Passpack compatible application, you will need this JSON variant in order to properly manage dates. Passpack.JSON.stringify(object)The Crockford JSON method to convert an Object into a JSON string. Passpack.utils.getBits(password)Returns the estimated value in bits of a password. Passpack.utils.passGenerator(pars,numberOfChars)Generates a random password. pars specifies the character interval to be used.
For example, to generate a random password of 16 characters, using letters and high ascii chars: Passpack.utils.passGenerator({
ucase: 1,
lcase: 1,
space: 1
}, 16);Passpack.utils.simplePassGenerator(numberOfChars)Generates a password using letters and numbers. Passpack.utils.genRandomKey([size,salt])Generates a hashed key of size chars, using an optional salt. By default generates a 256-bit key (64 chars). If you need longer key, you can concatenate two or more 256-bit keys. For example, to achieve a 512-bit key, concatenate two 256-bit keys. Passpack.utils.hashx(str[,nohex,full])Make a modified hash using SHA256. nohex produces a standard string instead of an hexadecimal string. full produces a 64 char strings, instead of a default 32 char modified string Passpack.SHA256 is based on Angel Marin's SHA-256. Enjoy Passpack Host-Proof Hosting |
Found a couple possible bugs in the js file.
Line 1281: return Passpack.HTP.utils.passGenerator({ Should be: return Passpack.utils.passGenerator({
Line 1258: var M = Passpack.charMatrixj?; Should be: var M = Passpack.utils.charMatrixj?;
I fixed the bug. Thanks.