Player APIs (BrightScript & Ja...
...
Object Reference
Hashing and Storage Objects

roPassKey

4min
this object provides a means for generating keys (hashes) from a password and salt the javascript equivalent is the node js crypto api object creation the object is passed an associative array that specifies the generation methods and cipher createobject("ropasskey", parameters as roassociativearray) the associative array should contain the following parameters method the key derivation method currently, only "pbkdf2" can be specified keyfn the pseudorandom function (prf) currently, only "hmac sha256" can be specified keylen the key length iterations the number of iterations ifpasskey generatekey(password as object, salt as object) as robytearray generates a key using the supplied password and salt the parameters may be passed as either strings or robytearray instances the generated robytearray instance may contain all possible byte values, including nul generatesalt(length as integer) as robytearray generates a salt of the specified length this salt can be used when calling the generatekey() method the generated robytearray instance may contain all possible byte values, including nul example ' create input test data salt = createobject("robytearray") pass = createobject("robytearray") pass fromasciistring("password") salt fromasciistring("salt") ' create the key generator pk = createobject("ropasskey", { method "pbkdf2", keyfn "hmac sha256", keylen 32, iterations 4096 } ) ' key with be a robytearray key = pk generatekey(pass, salt)