开发者

How to find Key and IV value from .Net to PHP

Can any one please let me know is there any way to find a solution for the below stuffs. I need to find out the KEY and IV value from the below byte array. the byte array in .net and this has to be convert into KEY(string) and IV(string) via PHP.

private static readonly byte[] Key = {
                                                0xda, 0x3c, 0x35, 0x6f, 0xbd, 0xd, 0x87, 0xf0,
                                                0x9a, 0x7, 0x6d, 0xab, 0x7e, 0x82, 0x36, 0xa,
                                                0x1a, 0x5a, 0x77, 0xfe, 0x74, 0xf3, 0x7f, 0xa8,
                                                0xaa, 0x4, 0x11, 0x46, 0x6b, 0x2d, 0x48, 0xa1
                                            };

        private开发者_高级运维 static readonly byte[] IV =  {
                                                0x6d, 0x2d, 0xf5, 0x34, 0xc7, 0x60, 0xc5, 0x33,
                                                0xe2, 0xa3, 0xd7, 0xc3, 0xf3, 0x39, 0xf2, 0x16
                                            };


Because characters in PHP are exactly one byte wide, the closest equivalent to a .NET byte array in PHP is a string:

$Key = "\xda\x3c\x35\x6f\xbd\xd\x87\xf0\x9a\x7\x6d\xab\x7e\x82\x36\xa\x1a\x5a\x77\xfe\x74\xf3\x7f\xa8\xaa\x4\x11\x46\x6b\x2d\x48\xa1";
$IV = "\x6d\x2d\xf5\x34\xc7\x60\xc5\x33\xe2\xa3\xd7\xc3\xf3\x39\xf2\x16";

Key.Length becomes strlen($Key) and Key[0] becomes $Key[0].

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜