Software Engineer. Stuff and nonsense. The usually short ramblings of Chris McKee.

How to match HMACSHA256 between C# & Python

Things are rarely simple or obvious when working across languages; especially when one is .net. Rather than waste time here's the code, in its long form. Test parameters With a key 182634d8894831d5dbce3b3185c50881 and a message or data value of some random junk with both solutions we should receive d94ed997943420b7d5dfb9b31ae236b7b5225510d8f0314c54ad44fb5fd44a06 C# public string HmacSHA256(string key, string data) { string hash; ASCIIEncoding encoder = new ASCIIEncoding(); Byte[] code = encoder.GetBytes(key); using (HMACSHA256 hmac = new HMACSHA256(code)) { Byte[] hmBytes…

CSS3 Recipes for Internet Explorer 6, 7 and 8

Recently as a quick fix to a headache I resorted to adding ‘behaviour’ css modifiers to my IE scripts to add CSS3 style behaviours for IE6/7/8; its a quick and easy thing to do simply refer to http://css3pie.com/ , but before you wonder off test one thing for me. Grab the file from that site and upload it to your server, then reference it in a page (nick the source of that webpage…