# \[solved\] SecureToken calculated hash does not match

**URL:** <https://community.wowza.com/t/solved-securetoken-calculated-hash-does-not-match/48240>\
**Category:** Wowza Streaming Engine\
**Tags:** server-administration\
**Created:** [March 8, 2017, 12:32am UTC](https://community.wowza.com/t/solved-securetoken-calculated-hash-does-not-match/48240 "2017-03-08T00:32:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anthony\_James1](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@Anthony\_James1](https://community.wowza.com/u/Anthony_James1)\
**Post date:** [March 8, 2017, 12:32am UTC](https://community.wowza.com/t/solved-securetoken-calculated-hash-does-not-match/48240/1 "2017-03-08T00:32:18Z")

</div>

Issue resolved, just wanted to post this for anyone else.

The SHA must be in **_BINARY_** before getting converted to base64. It does not say this in the documentation. I was encoding the SHA string. Im not sure why this has to be in binary and then converted to base64, SHA is already a string…

In PHP you must set the RAW parameter to true.

```auto
$hash = hash('sha256', $input, true);

```

* * *

I’ve been setting up SecureToken and cannot get the hashes to match.

Here are the results I get from the log:

```auto
2017-03-07	23:04:19	UTC	comment	server	INFO	200	-	[vod/_definst_]ModuleCoreSecurity:hashCalculated: jbGXphGTxO570_89Y_dpBTA1KUCtTGdVCKXXHjTkhDU=	-	-	-	0.029	-	-	-	-	--	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2017-03-07	23:04:19	UTC	comment	server	INFO	200	-	[vod/_definst_]ModuleCoreSecurity:string hashed: vod/sample.mp4?mySharedSecret&myTokenPrefixCustomParameter=abcdef&myTokenPrefixendtime=1500000000&myTokenPrefixstarttime=1395230400	-	-	-	0.029	-	-	-	-	-	-	-	-	-	-	-	-

```

If I were to calculate this hash myself:

```auto
$input = 'vod/sample.mp4?mySharedSecret&myTokenPrefixCustomParameter=abcdef&myTokenPrefixendtime=1500000000&myTokenPrefixstarttime=1395230400';
$hash = base64_encode(hash('sha256', $input));

```

The hash result I get is:

```auto
OGRiMTk3YTYxMTkzYzRlZTdiZDNmZjNkNjNmNzY5MDUzMDM1Mjk0MGFkNGM2NzU1MDhhNWQ3MWUzNGU0ODQzNQ==

```

This is not even close to what wowza is calculating for the hash, and this is set as SHA-256 in wowza
