Hi everyone, I'm trying to generate an Ethereum private and public key using this code (hardcoded strings are for testing):
const pkey = "695695e957585c76623d58dbfdd43f67df98f57fdf83419c49eb18a817f10d84d3d6bb69cc711422c0bd719d43db3542c8a1b7af42d14a1bd29038e53f81aca4";
const skey = "d94e7a6c775d38e8682abe53b97e84b954ca02dc66f048e551340202f9974d33";
var h = Keccak_256.init(.{});
var out: [32]u8 = undefined;
h.update("695695e957585c76623d58dbfdd43f67df98f57fdf83419c49eb18a817f10d84d3d6bb69cc711422c0bd719d43db3542c8a1b7af42d14a1bd29038e53f81aca4");
h.final(&out);
std.log.info("{s}", .{skey});
std.log.info("{s}", .{pkey});
std.log.info("{s}", .{fmt.fmtSliceHexLower(&out)});
and the output that I got is this:
info: d94e7a6c775d38e8682abe53b97e84b954ca02dc66f048e551340202f9974d33
info: 695695e957585c76623d58dbfdd43f67df98f57fdf83419c49eb18a817f10d84d3d6bb69cc711422c0bd719d43db3542c8a1b7af42d14a1bd29038e53f81aca4
info: e92d53f69a143487a5fafd61e2bfb56fea85fddf7c941dc72819b1e77c4977db
but the hashed public key is wrong, should be "6e4e5948ac7c1c1387ab549d07211b6ab8a77c67ced9d1f0056050c72eb853dc", where is the error? Am I missing something?