my $str = "hello"; # no special chars, 1-127 my $sha256 = Digest::SHA::sha256("abc123"); # bytes 0-255 my $hmac = Digest::SHA::hmac_sha512("a message", "a key"); # bytes 0-255 # edit, the following is mangled by PM's editor, imagine greek letters here: my $unicode_string = "αβγαabc123"; # unicode chars mixed with lower-ascii my $buffer = ""; # buffer to concatenate above into and POST them for($str, $sha256, $hmac, $unicode_string){ $buffer .= Encode::encode("UTF-8", $_); } my $b64 = base64_encode($buffer); my $HTTPheader = "ABC: $b64"; $ua->POST("aurl" ... $b64 ... $HTTPheader ...); $ua->GET("aurl" ... $b64 ... $HTTPheader ...); $ua->POST("aurl" ... $buffer ... $HTTPheader ...); $ua->GET("aurl" ... $buffer ... $HTTPheader ...); $ua->GET("aurl" ... $unicode_string ... $HTTPheader ...); #### postdata = urllib.parse.urlencode(data) encoded = (str(data['nonce']) + postdata).encode() message = urlpath.encode() + hashlib.sha256(encoded).digest() #### my $postdata = Encode::encode('UTF-8', "x=1&y=2&z=greektext"); # for example, my $p1 = "$nonsense".'&'.$postdata; # yes & needed my $p1_utf8 = Encode::encode_utf8($p1); my $api_sha256 = Digest::SHA::sha256($p1_utf8); my $message = Encode::encode_utf8($api_path) . Encode::encode_utf8($api_method) . $api_sha256; #<< last one is binary # ... and post after some more massaging