- Code: Select all
private function makeHash( mUserId:String, mSecret:String ):String {
var now:Date = new Date();
var unixTime:String = Math.round( now.time * .001 ).toString();
var message:String = unixTime + ":" + mUserId;
return unixTime + ":" + HMAC.hash( mSecret, message, SHA1 );
}
HMAC and SHA1 are classes provided as part of as3corelib (https://github.com/mikechambers/as3corelib). You'll just need to import them like so:
- Code: Select all
import com.adobe.crypto.SHA1;
import com.adobe.crypto.HMAC;