I have a series of hex bytes. Theoretically, the last 20 bytes are the sha1 hash of the first part:
3F F4 E5 25 98 20 52 70 01 63 00 68 00 75 00 79 00 69 00 00 00 74 28 96 10 09 9D C9 01 00 74 A0 D7 DB 0B 9D C9 01 4D 00 79 00 47 00 72 00 6F 00 75 00 70 00 00 00 2F 00 00 00 BD 0D EA 71 BE 0B 25 75 E7 5C 58 20 31 57 F3 9A EF 69 1B FD
If I apply sha1 to them in PHP like this:
echo sha1("3FF4E525982052700163006800750079006900000074289610099DC9010074A0D7DB0B9DC9014D007900470072006F007500700000002F000000");
I get back:
d68ca0839df6e5ac7069cc548d82f249752f3acb
But I'm looking for this value:
bd0dea71be0b2575e75c58203157f39aef691bfd
(BD 0D EA 71 BE 0B 25 75 E7 5C 58 20 31 57 F3 9A EF 69 1B FD)
Is it because I'm treating the hex values as a string? What do I need to do?
Edit:
Here's the original information I am working from:
ticketBytes {byte[0x0000003a]} [0x00000000]: 0x3f [0x00000001]: 0xf4 [0x00000002]: 0xe5 [0x00000003]: 0x25 [0x00000004]: 0x98 [0x00000005]: 0x20 [0x00000006]: 0x52 [0x00000007]: 0x70 [0x00000008]: 0x01 [0x00000009]: 0x63 [0x0000000a]: 0x00 [0x0000000b]: 0x68 [0x0000000c]: 0x00 [0x0000000d]: 0x75 [0x0000000e]: 0x00 [0x0000000f]: 0x79 [0x00000010]: 0x00 [0x00000011]: 0x69 [0x00000012]: 0x00 [0x00000013]: 0x00 [0x00000014]: 0x00 [0x00000015]: 0x74 [0x00000016]: 0x28 [0x00000017]: 0x96 [0x00000018]: 0x10 [0x00000019]: 0x09 [0x0000001a]: 0x9d [0x0000001b]: 0xc9 [0x0000001c]: 0x01 [0x0000001d]: 0x00 [0x0000001e]: 0x74 [0x0000001f]: 0xa0 [0x00000020]: 0xd7 [0x00000021]: 0xdb [0x00000022]: 0x0b [0x00000023]: 0x9d [0x00000024]: 0xc9 [0x00000025]: 0x01 [0x00000026]: 0x4d [0x00000027]: 0x00 [0x00000028]: 0x79 [0x00000029]: 0x00 [0x0000002a]: 0x47 [0x0000002b]: 0x00 [0x0000002c]: 0x72 [0x0000002d]: 0x00 [0x0000002e]: 0x6f [0x0000002f]: 0x00 [0x00000030]: 0x75 [0x00000031]: 0x00 [0x00000032]: 0x70 [0x00000033]: 0x00 [0x00000034]: 0x00 [0x00000035]: 0x00 [0x00000036]: 0x2f [0x00000037]: 0x00 [0x00000038]: 0x00 [0x00000039]: 0x00
hashed {byte[0x00000014]} [0x00000000]: 0xbd [0x00000001]: 0x0d [0x00000002]: 0xea [0x00000003]: 0x71 [0x00000004]: 0xbe [0x00000005]: 0x0b [0x00000006]: 0x25 [0x00000007]: 0x75 [0x00000008]: 0xe7 [0x00000009]: 0x5c [0x0000000a]: 0x58 [0x0000000b]: 0x20 [0x0000000c]: 0x31 [0x0000000d]: 0x57 [0x0000000e]: 0xf3 [0x0000000f]: 0x9a [0x00000010]: 0xef [0x00000011]: 0x69 [0x00000012]: 0x1b [0x00000013]: 0xfd