nl_tokens: Generates the Name - Based UUID hashes v3 and v5 according to RFC - 4122 https : // tools . ietf . org / html / rfc4122#section - 4 . 3
pl_tokens: function generateUuid ( target , namespace , version ) { if ( typeof target !== 'string' ) { throw TypeError ( 'Value must be string' ) ; } if ( typeof namespace === 'number' ) { return generateUuid ( target , undefined , namespace ) ; } if ( version == null ) { return generateUuid ( target , namespace , 5 ) ; } if ( version !== 3 && version !== 5 ) { throw TypeError ( 'Version of UUID can be only 3 or 5' ) ; } // Parsing target chars var charBuffer = lib . stringToCharBuffer ( target ) ; // TODO: Test namespace for uuid and parse to buffer var namespaceCharBuffer = typeof namespace === 'string' ? lib . stringToCharBuffer ( namespace ) : EMPTY_UINT8_ARRAY ; // Concatenation two buffers of strings to one var buffer = lib . concatBuffers ( namespaceCharBuffer , charBuffer ) ; // Getting hash var hash = version === 3 ? lib . md5Hash ( buffer ) : lib . sha1Hash ( <mask> ) ; return lib . hashToUuid ( hash , version ) ; }