.net - How to hash a UTF-8 string in Classic ASP -
.net - How to hash a UTF-8 string in Classic ASP -
i've been looking classic asp script allows me hash string using md5 algorithm. need match hashed string against same string in asp.net page, hashed using .net's md5 hashing algorithms.
even though have found several scripts classic asp generate hash, haven't found 1 generates right hash using non-english characters (like ñ
, example).
do know classic asp script works in particular case?
note:
i have tried these scripts:
http://userpages.umbc.edu/~mabzug1/cs/md5/md5.asp
http://forums.aspfree.com/code-bank-54/asp-classic-md5-hash-82164.html
examples:
string:
muñecacorrect md5 hash:
ea07bec1f37f4b56ebe368355d1c058fgenerated hash:
298e60cb1179df15d5772726a3975132
the first part of hashing string getting byte array of string's characters. byte array created depends on encoding type used string. .net strings encoded in utf-16. don't recall vbscript's encoding type off type of head, it's ascii or @ best utf-8.
therefore, prepare problem, first thing need vbscript give byte array represents utf-16 characters in string. go md5 hash function expects byte array directly, instead of string type.
unfortunately, may not enough. it's possible vbscript's lack of native utf-16 result in minor loss of fidelity in string input user, such string in classic asp code no longer same characters string in asp.net code. if case, solution alter asp.net code match classic asp encoding, rather vice versa. may much easier solution anyway. work, need know exactly character encoding vbscript code using. again, don't have info in head anymore, can google i.
.net asp-classic utf-8 character-encoding md5
Comments
Post a Comment