On Saturday, 2 December 2023 at 16:17:08 UTC, user1234 wrote:
On Saturday, 2 December 2023 at 15:30:39 UTC, zoujiaqing wrote:
[...]
sign is binary, you have to use the toHexString utility :
```d
import std.stdio;
import std.digest.sha;
void main()
{
SHA256 sha256;
sha256.start();
string appKey =
"11111111111111111111111111111111111111111111111111111";
sha256.put(cast(ubyte[])appKey);
ubyte[32] sign = sha256.finish();
writeln("sign: %s", toHexString(sign));
}
```
also you add a range error on data assignment.
and a last error I have not initially catch, use writefln:
```d
writefln("sign: %s", toHexString(sign));
```