I am trying to send a SHA256 hashed string on top of HTTP to a server where I want to authenticate by performing the SHA256 hash and checking for two matches. For testing purposes, I use the same line, however my results do not match. Could this be something with standard coding schemes for my base64_encode calls? Thanks.
In PHP, I do:
$sha = hash("sha256", $url, true); $sha = base64_encode(urlencode($sha));
And in go i do
//convert string to byte slice converted := []byte(to_hash) //hash the byte slice and return the resulting string hasher := sha256.New() hasher.Write(converted) return (base64.URLEncoding.EncodeToString(hasher.Sum(nil)))
php go sha sha256
user387049
source share