Hash with client IP - problem

Hi. I have WowzaStreamingEngine-4.2.0. I have application using securetoken2 with option “Include client IP address in hash generation”. I’m observing problem with ip address contains 2 digits (ex. 94.254.xxx.xxx). Then I get error

HTTPStreamerAdapterCupertinoStreamer.onPlaylist[live/mp4:myStream/playlist.m3u8?wowzatokenendtime=1490709720&wowzatokenstarttime=1490698920&wowzatokenhash=K93Wlv8C8RikCJAnq8ItjNMOpWqa_rxqftmcxubVHws=]: Session not accepted[1071131671]

On address wher every parts has 3 digits (xxx.xxx.xxx.xxx) the problem is no exist.

This is my code:

$ip = $_SERVER['HTTP_CLIENT_IP']?:($_SERVER['HTTP_X_FORWARDED_FOR']?:$_SERVER['REMOTE_ADDR']); 
$wowzastart = strtotime(date('d-m-Y H:i')); 
$wowzaend = strtotime(date('d-m-Y H:i')) +  10800; 
$secret = '****'; 
$wowzatokenprefix = 'wowzatoken'; 

$hashstr = hash('sha256', 'live/mp4:myStream?'.$ip.'&'.$secret.'&'.$wowzatokenprefix.'endtime='.$wowzaend.'&'.$wowzatokenprefix.'starttime='.$wowzastart.'', true); 

$usableHash= strtr(base64_encode($hashstr), '+/', '-_'); 

$url = "http://wowzaserver.com:1935/live/mp4:myStream/playlist.m3u8?".$wowzatokenprefix."endtime=".$wowzaend."&".$wowzatokenprefix."starttime=".$wowzastart."&".$wowzatokenprefix."hash=".$usableHash.""; 

It seems to be a problem with wowza.

Anyone can help me? What should I do?

Hello,

Thanks for contacting the Wowza Community!

If you take your custom code out the picture, do you see the issue with 2 digits instead of 3 digits?

regards,

Jermaine

Yes, I think so. IP is the only difference. I don’t know why that is, but i think it’s a problem in wowza server.

p.s. On address where first part has 3 digits (xxx.xxx.xxx.xxx) the problem is no exist - on my ip xxx.xxx.180.3 ewerything working fine.

i’m facing the same issue here, any update ?

@Paweł Andrzejczak Change Hash Algorithm to SHA-512 .

But I also have a problem, when client use Ipv6 , that stream not working.

Wowza Streaming Engine supports IPv6; however, the computer that runs software must also support IPV6, and Java JDK 1.7 (or later) is required.

Let me know if that fixes things- thanks.

https://www.wowza.com/docs/how-to-use-ipv6-networking-in-wowza-media-server-software

eg : when I access my stream with Ipv4 :

http://wowza-ipaddress:1935/live/my.stream/playlist.m3u8?74.50.208.90&endtime=1559579520&starttime=0&hash=3IA3RRUIRcoplLotZeEgmvOtsJgOXoufuP2HVFcUJwv53uA-ZRk7B3kWEr2bJl1whXM7Hr-xHfcFC66kngmkJQ==

but with Ipv6 ( eg I use japan proxy - eg 45.32.63.123)

http://wowza-ipaddress:1935/live/my.stream/playlist.m3u8?2001:19f0:7001:36ce:1520:e616:29f7:8944&endtime=1559579700&starttime=0&hash=coFvn2j83aZmAsHu0paNSG191wloglh9fniaDY2ugB9pt8_93Gg44jbr89clGM5HROZsj1fpQNd-mFWPhpz2jA==

stream link not working