Jeremy Spilman [ARCHIVE] on Nostr: 📅 Original date posted:2014-01-14 📝 Original message:On Tue, 14 Jan 2014 ...
📅 Original date posted:2014-01-14
📝 Original message:On Tue, 14 Jan 2014 13:51:06 -0800, Adam Back <adam at cypherspace.org> wrote:
> I saw in the math version you had said Q'=Q+H(S) and I presumed it was a
> typo, but your code says the same thing. I presume you meant Q'=Q+H(S)*G
> and therefore that Util.SingleSHA256() multiplies by G internally?
>
> Adam
>
Thanks for reviewing this. The relevant line:
byte[] q1New = EC.PointAdd(Q1, Util.SingleSHA256(S1));
SingleSHA256 is a single application of SHA256 -- named so since 'SHA256'
functions in many Bitcoin libraries too often actually run DoubleSHA256.
32 bytes are returned.
The multiplication by 'G' that you mention is part of my EC.PointAdd...
I should probably just publish all my code as MIT and be done with it ;-)
Thanks,
Jeremy
public static byte[] PointAdd(byte[] point, byte[] scalar, bool compressed
= true)
{
var point1 = new OpenSSL.Crypto.EC.Point(EcGroup, point);
var num = OpenSSL.Core.BigNumber.FromArray(scalar);
var point2 = OpenSSL.Crypto.EC.Point.Multiply(EcGroup, num,
EcBnContext);
var result = point1.Add(point2, EcBnContext);
if (compressed)
return result.GetBytes(ConversionForm.Compressed);
else
return result.GetBytes(ConversionForm.Uncompressed);
}
Published at
2023-06-07 15:11:54Event JSON
{
"id": "a80d17093c32b5414c822e7c896ee316fac2a3f41c235058bafbf09a273ce90b",
"pubkey": "7e57666cff7c86f9410d33d4d34ef3e5105395b3c74af472541dbeeb743f9de3",
"created_at": 1686150714,
"kind": 1,
"tags": [
[
"e",
"6b79d8c7bec3dc6952db91cc68d0510d9897c37dcf58a24d8e2f4288fe42525c",
"",
"root"
],
[
"e",
"3b43744cd912d5465cecb732879b966d8e11e0fc5e0ad6b214bbd3d1f2f3c5a9",
"",
"reply"
],
[
"p",
"ee0fa66772f633411e4432e251cfb15b1c0fe8cd8befd8b0d86eb302402a8b4a"
]
],
"content": "📅 Original date posted:2014-01-14\n📝 Original message:On Tue, 14 Jan 2014 13:51:06 -0800, Adam Back \u003cadam at cypherspace.org\u003e wrote:\n\u003e I saw in the math version you had said Q'=Q+H(S) and I presumed it was a\n\u003e typo, but your code says the same thing. I presume you meant Q'=Q+H(S)*G\n\u003e and therefore that Util.SingleSHA256() multiplies by G internally?\n\u003e\n\u003e Adam\n\u003e\n\nThanks for reviewing this. The relevant line:\n\n byte[] q1New = EC.PointAdd(Q1, Util.SingleSHA256(S1));\n\nSingleSHA256 is a single application of SHA256 -- named so since 'SHA256' \nfunctions in many Bitcoin libraries too often actually run DoubleSHA256. \n32 bytes are returned.\n\nThe multiplication by 'G' that you mention is part of my EC.PointAdd...\n\nI should probably just publish all my code as MIT and be done with it ;-)\n\nThanks,\nJeremy\n\n\npublic static byte[] PointAdd(byte[] point, byte[] scalar, bool compressed \n= true)\n{\n var point1 = new OpenSSL.Crypto.EC.Point(EcGroup, point);\n\n var num = OpenSSL.Core.BigNumber.FromArray(scalar);\n var point2 = OpenSSL.Crypto.EC.Point.Multiply(EcGroup, num, \nEcBnContext);\n\n var result = point1.Add(point2, EcBnContext);\n\n if (compressed)\n return result.GetBytes(ConversionForm.Compressed);\n else\n return result.GetBytes(ConversionForm.Uncompressed);\n}",
"sig": "7462559eb281ba51db47c2313355e2e5717fdd5d19e1717d624721f0a3f1589818889e97542045948f4966373e06079f3183acccc9b0576fdb4ee2d868f59693"
}