Skip to content

Instantly share code, notes, and snippets.

@thomasuster
Created January 8, 2017 18:10
Show Gist options
  • Save thomasuster/a5dd68c2cf93f3280ab97526b193ff3c to your computer and use it in GitHub Desktop.
Save thomasuster/a5dd68c2cf93f3280ab97526b193ff3c to your computer and use it in GitHub Desktop.
package com.thomasuster.ws;
import haxe.io.Bytes;
import haxe.crypto.Sha1;
import haxe.crypto.Base64;
class HandShaker {
public function new() {}
public function shake(key:String):String {
var magic:String = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11';
var concated:Bytes = Bytes.ofString(key+magic);
return Base64.encode(Sha1.make(concated));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment