/// <summary> /// Saves the value of the resource, to persisted storage. /// </summary> /// <returns></returns> public override async Task WritePersistedValue() { if (this.value != null) { await RuntimeSettings.SetAsync(this.Path, Hashes.BinaryToString(this.value)); } }
public void Test_02_1600_bits() { SHAKE256 H = new SHAKE256(4096); int i = 0; H.NewState += (sender, e) => { string Expected = States1600Bits[i++].Replace(" ", string.Empty); string Actual = Hashes.BinaryToString(H.GetState()).ToUpper(); Assert.AreEqual(Expected, Actual); }; byte[] Input = new byte[200]; int j; for (j = 0; j < 200; j++) { Input[j] = 0xa3; } byte[] Digest = H.ComputeVariable(Input); string s = Hashes.BinaryToString(Digest); Assert.AreEqual("cd8a920ed141aa0407a22d59288652e9d9f1a7ee0c1e7c1ca699424da84a904d2d700caae7396ece96604440577da4f3aa22aeb8857f961c4cd8e06f0ae6610b1048a7f64e1074cd629e85ad7566048efc4fb500b486a3309a8f26724c0ed628001a1099422468de726f1061d99eb9e93604d5aa7467d4b1bd6484582a384317d7f47d750b8f5499512bb85a226c4243556e696f6bd072c5aa2d9b69730244b56853d16970ad817e213e470618178001c9fb56c54fefa5fee67d2da524bb3b0b61ef0e9114a92cdbb6cccb98615cfe76e3510dd88d1cc28ff99287512f24bfafa1a76877b6f37198e3a641c68a7c42d45fa7acc10dae5f3cefb7b735f12d4e589f7a456e78c0f5e4c4471fffa5e4fa0514ae974d8c2648513b5db494cea847156d277ad0e141c24c7839064cd08851bc2e7ca109fd4e251c35bb0a04fb05b364ff8c4d8b59bc303e25328c09a882e952518e1a8ae0ff265d61c465896973d7490499dc639fb8502b39456791b1b6ec5bcc5d9ac36a6df622a070d43fed781f5f149f7b62675e7d1a4d6dec48c1c7164586eae06a51208c0b791244d307726505c3ad4b26b6822377257aa152037560a739714a3ca79bd605547c9b78dd1f596f2d4f1791bc689a0e9b799a37339c04275733740143ef5d2b58b96a363d4e08076a1a9d7846436e4dca5728b6f760eef0ca92bf0be5615e96959d767197a0beeb", s); Assert.AreEqual(States1600Bits.Length, i); }
public void Test_02_1600_bits() { SHA3_256 H = new SHA3_256(); int i = 0; H.NewState += (sender, e) => { string Expected = States1600Bits[i++].Replace(" ", string.Empty); string Actual = Hashes.BinaryToString(H.GetState()).ToUpper(); Assert.AreEqual(Expected, Actual); }; byte[] Input = new byte[200]; int j; for (j = 0; j < 200; j++) { Input[j] = 0xa3; } byte[] Digest = H.ComputeVariable(Input); string s = Hashes.BinaryToString(Digest); Assert.AreEqual("79f38adec5c20307a98ef76e8324afbfd46cfd81b22e3973c65fa1bd9de31787", s); Assert.AreEqual(States1600Bits.Length, i); }
public void Test_02_1600_bits() { SHA3_224 H = new SHA3_224(); int i = 0; H.NewState += (sender, e) => { string Expected = States1600Bits[i++].Replace(" ", string.Empty); string Actual = Hashes.BinaryToString(H.GetState()).ToUpper(); Assert.AreEqual(Expected, Actual); }; byte[] Input = new byte[200]; int j; for (j = 0; j < 200; j++) { Input[j] = 0xa3; } byte[] Digest = H.ComputeVariable(Input); string s = Hashes.BinaryToString(Digest); Assert.AreEqual("9376816aba503f72f96ce7eb65ac095deee3be4bf9bbc2a1cb7e11e0", s); Assert.AreEqual(States1600Bits.Length, i); }
/// <summary> /// Generates HTML for the markdown element. /// </summary> /// <param name="Output">HTML will be output here.</param> /// <param name="Rows">Code rows.</param> /// <param name="Language">Language used.</param> /// <param name="Indent">Additional indenting.</param> /// <param name="Document">Markdown document containing element.</param> /// <returns>If content was rendered. If returning false, the default rendering of the code block will be performed.</returns> public bool GenerateHTML(StringBuilder Output, string[] Rows, string Language, int Indent, MarkdownDocument Document) { string LoadingText; int i = Language.IndexOf(':'); if (i > 0) { LoadingText = Language.Substring(i + 1).Trim(); } else { LoadingText = "⌛"; } string Id = Hashes.BinaryToString(Gateway.NextBytes(32)); Output.Append("<div id=\"id"); Output.Append(Id); Output.Append("\">"); Output.Append(LoadingText); Output.AppendLine("</div>"); Output.Append("<script type=\"text/javascript\">LoadContent(\""); Output.Append(Id); Output.AppendLine("\");</script>"); Expression Script = this.BuildExpression(Rows); Variables Variables = new Variables(); Document.Settings.Variables.CopyTo(Variables); Document.QueueAsyncTask(() => this.Evaluate(Script, Variables, Id)); return(true); }
public void Test_02_1600_bits() { SHA3_512 H = new SHA3_512(); int i = 0; H.NewState += (sender, e) => { string Expected = States1600Bits[i++].Replace(" ", string.Empty); string Actual = Hashes.BinaryToString(H.GetState()).ToUpper(); Assert.AreEqual(Expected, Actual); }; byte[] Input = new byte[200]; int j; for (j = 0; j < 200; j++) { Input[j] = 0xa3; } byte[] Digest = H.ComputeVariable(Input); string s = Hashes.BinaryToString(Digest); Assert.AreEqual("e76dfad22084a8b1467fcf2ffa58361bec7628edf5f3fdc0e4805dc48caeeca81b7c13c30adf52a3659584739a2df46be589c51ca1a4a8416df6545a1ce8ba00", s); Assert.AreEqual(States1600Bits.Length, i); }
public void Test_21_X448_ECDH() { byte[] A = Hashes.StringToBinary("9a8f4925d1519f5775cf46b04b5800d4ee9ee8bae8bc5565d498c28dd9c9baf574a9419744897391006382a6f127ab1d9ac2d8c0a598726b"); Curve448 Alice = new Curve448(A); Assert.AreEqual("9b08f7cc31b7e3e67d22d5aea121074a273bd2b83de09c63faa73d2c22c5d9bbc836647241d953d40c5b12da88120d53177f80e532c41fa000", Hashes.BinaryToString(Alice.PublicKey)); A = Hashes.StringToBinary("1c306a7ac2a0e2e0990b294470cba339e6453772b075811d8fad0d1d6927c120bb5ee8972b0d3e21374c9c921b09d1b0366f10b65173992d"); Curve448 Bob = new Curve448(A); Assert.AreEqual("3eb7a829b0cd20f5bcfc0b599b6feccf6da4627107bdb0d4f345b43027d8b972fc3e34fb4232a13ca706dcb57aec3dae07bdc1c67bf33609", Hashes.BinaryToString(Bob.PublicKey)); byte[] Key1 = Alice.GetSharedKey(Bob.PublicKey, Hashes.ComputeSHA256Hash); byte[] Key2 = Bob.GetSharedKey(Alice.PublicKey, Hashes.ComputeSHA256Hash); string k1 = Hashes.BinaryToString(Key1); string k2 = Hashes.BinaryToString(Key2); Assert.AreEqual(k1, k2); A = Hashes.StringToBinary("07fff4181ac6cc95ec1c16a94a0f74d12da232ce40a77552281d282bb60c0b56fd2464c335543936521c24403085d59a449a5037514a879d"); if (A.Length != 56) { Array.Resize <byte>(ref A, 56); } Array.Reverse(A); // Most significant byte first. A = Hashes.ComputeSHA256Hash(A); string k3 = Hashes.BinaryToString(A); Assert.AreEqual(k1, k3); }
/// <summary> /// Is called when an object is started. /// </summary> /// <param name="ObjectId">ID of object.</param> /// <param name="TypeName">Type name of object.</param> public virtual Task<string> StartObject(string ObjectId, string TypeName) { if (this.mapObjectIds) { string ObjectId0 = ObjectId; if (!this.objectIdMap.TryGetValue(ObjectId0, out ObjectId)) { byte[] A; int i, c; if (System.Guid.TryParse(ObjectId0, out Guid Guid)) A = Guid.ToByteArray(); else A = Hashes.StringToBinary(ObjectId0); if (!(A is null) && (c = A.Length) != this.objectIdByteCount) { if (c > this.objectIdByteCount) { if (c == 16) { for (i = this.objectIdByteCount; i < c; i++) A[i] = 0; ObjectId = new Guid(A).ToString(); } else { Array.Resize<byte>(ref A, this.objectIdByteCount); ObjectId = Hashes.BinaryToString(A); } } else { Array.Resize<byte>(ref A, this.objectIdByteCount); if (this.objectIdByteCount == 16) ObjectId = new Guid(A).ToString(); else ObjectId = Hashes.BinaryToString(A); } while (this.objectIdMap.ContainsKey(ObjectId)) { if (this.objectIdByteCount == 16) ObjectId = Guid.NewGuid().ToString(); else { A = Gateway.NextBytes(this.objectIdByteCount); ObjectId = Hashes.BinaryToString(A); } } this.objectIdMap[ObjectId0] = ObjectId; } else ObjectId = ObjectId0; } }
public void Test_15_X25519_ECDH() { byte[] A = Hashes.StringToBinary("77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a"); Curve25519 Alice = new Curve25519(A); Assert.AreEqual("8520f0098930a754748b7ddcb43ef75a0dbf3a0d26381af4eba4a98eaa9b4e6a", Hashes.BinaryToString(Alice.PublicKey)); A = Hashes.StringToBinary("5dab087e624a8a4b79e17f8b83800ee66f3bb1292618b6fd1c2f8b27ff88e0eb"); Curve25519 Bob = new Curve25519(A); Assert.AreEqual("de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f", Hashes.BinaryToString(Bob.PublicKey)); byte[] Key1 = Alice.GetSharedKey(Bob.PublicKey, Hashes.ComputeSHA256Hash); byte[] Key2 = Bob.GetSharedKey(Alice.PublicKey, Hashes.ComputeSHA256Hash); string k1 = Hashes.BinaryToString(Key1); string k2 = Hashes.BinaryToString(Key2); Assert.AreEqual(k1, k2); A = Hashes.StringToBinary("4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742"); if (A.Length != 32) { Array.Resize <byte>(ref A, 32); } Array.Reverse(A); // Most significant byte first. A = Hashes.ComputeSHA256Hash(A); string k3 = Hashes.BinaryToString(A); Assert.AreEqual(k1, k3); }
public void Test_02_1600_bits() { SHA3_384 H = new SHA3_384(); int i = 0; H.NewState += (sender, e) => { string Expected = States1600Bits[i++].Replace(" ", string.Empty); string Actual = Hashes.BinaryToString(H.GetState()).ToUpper(); Assert.AreEqual(Expected, Actual); }; byte[] Input = new byte[200]; int j; for (j = 0; j < 200; j++) { Input[j] = 0xa3; } byte[] Digest = H.ComputeVariable(Input); string s = Hashes.BinaryToString(Digest); Assert.AreEqual("1881de2ca7e41ef95dc4732b8f5f002b189cc1e42b74168ed1732649ce1dbcdd76197a31fd55ee989f2d7050dd473e8f", s); Assert.AreEqual(States1600Bits.Length, i); }
public void Test_02_Encrypt() { // �4.2 byte[] Key = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }; byte[] Nonce = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x00 }; uint BlockCount = 1; ChaCha20 Cipher = new ChaCha20(Key, BlockCount, Nonce); byte[] Data = Encoding.ASCII.GetBytes("Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it."); Assert.AreEqual("4c616469657320616e642047656e746c656d656e206f662074686520636c617373206f66202739393a204966204920636f756c64206f6666657220796f75206f6e6c79206f6e652074697020666f7220746865206675747572652c2073756e73637265656e20776f756c642062652069742e", Hashes.BinaryToString(Data)); byte[] Encrypted = Cipher.EncryptOrDecrypt(Data); Assert.AreEqual("6e2e359a2568f98041ba0728dd0d6981e97e7aec1d4360c20a27afccfd9fae0bf91b65c5524733ab8f593dabcd62b3571639d624e65152ab8f530c359f0861d807ca0dbf500d6a6156a38e088a22b65e52bc514d16ccf806818ce91ab77937365af90bbf74a35be6b40b8eedf2785e42874d", Hashes.BinaryToString(Encrypted)); }
public void Test_02_1600_bits() { SHAKE128 H = new SHAKE128(4096); int i = 0; H.NewState += (sender, e) => { string Expected = States1600Bits[i++].Replace(" ", string.Empty); string Actual = Hashes.BinaryToString(H.GetState()).ToUpper(); Assert.AreEqual(Expected, Actual); }; byte[] Input = new byte[200]; int j; for (j = 0; j < 200; j++) { Input[j] = 0xa3; } byte[] Digest = H.ComputeVariable(Input); string s = Hashes.BinaryToString(Digest); Assert.AreEqual("131ab8d2b594946b9c81333f9bb6e0ce75c3b93104fa3469d3917457385da037cf232ef7164a6d1eb448c8908186ad852d3f85a5cf28da1ab6fe3438171978467f1c05d58c7ef38c284c41f6c2221a76f12ab1c04082660250802294fb87180213fdef5b0ecb7df50ca1f8555be14d32e10f6edcde892c09424b29f597afc270c904556bfcb47a7d40778d390923642b3cbd0579e60908d5a000c1d08b98ef933f806445bf87f8b009ba9e94f7266122ed7ac24e5e266c42a82fa1bbefb7b8db0066e16a85e0493f07df4809aec084a593748ac3dde5a6d7aae1e8b6e5352b2d71efbb47d4caeed5e6d633805d2d323e6fd81b4684b93a2677d45e7421c2c6aea259b855a698fd7d13477a1fe53e5a4a6197dbec5ce95f505b520bcd9570c4a8265a7e01f89c0c002c59bfec6cd4a5c109258953ee5ee70cd577ee217af21fa70178f0946c9bf6ca8751793479f6b537737e40b6ed28511d8a2d7e73eb75f8daac912ff906e0ab955b083bac45a8e5e9b744c8506f37e9b4e749a184b30f43eb188d855f1b70d71ff3e50c537ac1b0f8974f0fe1a6ad295ba42f6aec74d123a7abedde6e2c0711cab36be5acb1a5a11a4b1db08ba6982efccd716929a7741cfc63aa4435e0b69a9063e880795c3dc5ef3272e11c497a91acf699fefee206227a44c9fb359fd56ac0a9a75a743cff6862f17d7259ab075216c0699511643b6439", s); Assert.AreEqual(States1600Bits.Length, i); }
private void RandomizePassword(HttpRequest Request, HttpResponse Response) { Gateway.AssertUserAuthenticated(Request); Response.StatusCode = 200; Response.ContentType = "text/plain"; Response.Write(Hashes.BinaryToString(Gateway.NextBytes(32))); }
private async Task RegisterDevice(MetaDataTag[] MetaInfo) { string Key = await RuntimeSettings.GetAsync("ThingRegistry.Key", string.Empty); if (string.IsNullOrEmpty(Key)) { byte[] Bin = new byte[32]; using (RandomNumberGenerator Rnd = RandomNumberGenerator.Create()) { Rnd.GetBytes(Bin); } Key = Hashes.BinaryToString(Bin); await RuntimeSettings.SetAsync("ThingRegistry.Key", Key); } int c = MetaInfo.Length; Array.Resize <MetaDataTag>(ref MetaInfo, c + 1); MetaInfo[c] = new MetaDataStringTag("KEY", Key); this.registryClient.RegisterThing(false, MetaInfo, async(sender, e) => { try { if (e.Ok) { await RuntimeSettings.SetAsync("ThingRegistry.Location", true); await RuntimeSettings.SetAsync("ThingRegistry.Owner", e.OwnerJid); if (string.IsNullOrEmpty(e.OwnerJid)) { string ClaimUrl = registryClient.EncodeAsIoTDiscoURI(MetaInfo); string FilePath = ApplicationData.Current.LocalFolder.Path + Path.DirectorySeparatorChar + "Actuator.iotdisco"; Log.Informational("Registration successful."); Log.Informational(ClaimUrl, new KeyValuePair <string, object>("Path", FilePath)); File.WriteAllText(FilePath, ClaimUrl); } else { await RuntimeSettings.SetAsync("ThingRegistry.Key", string.Empty); Log.Informational("Registration updated. Device has an owner.", new KeyValuePair <string, object>("Owner", e.OwnerJid)); } } else { Log.Error("Registration failed."); await this.RegisterDevice(); } } catch (Exception ex) { Log.Critical(ex); } }, null); }
public void Test_08_SHAKE128_3() { SHAKE128 H = new SHAKE128(256); byte[] Digest = H.ComputeVariable(new MemoryStream(Encoding.ASCII.GetBytes("The quick brown fox jumps over the lazy dof"))); string s = Hashes.BinaryToString(Digest); Assert.AreEqual("853f4538be0db9621a6cea659a06c1107b1f83f02b13d18297bd39d7411cf10c", s); }
public void Test_07_SHAKE128_2() { SHAKE128 H = new SHAKE128(256); byte[] Digest = H.ComputeVariable(new MemoryStream(Encoding.ASCII.GetBytes("The quick brown fox jumps over the lazy dog"))); string s = Hashes.BinaryToString(Digest); Assert.AreEqual("f4202e3c5852f9182a0430fd8144f0a74b95e7417ecae17db0f8cfeed0e3e66e", s); }
public void Test_05_SHAKE128() { SHAKE128 H = new SHAKE128(256); byte[] Digest = H.ComputeVariable(new MemoryStream(new byte[0])); string s = Hashes.BinaryToString(Digest); Assert.AreEqual("7f9c2ba4e88f827d616045507605853ed73b8093f6efbc88eb1a6eacfa66ef26", s); }
public void Test_06_SHAKE256() { SHAKE256 H = new SHAKE256(512); byte[] Digest = H.ComputeVariable(new MemoryStream(new byte[0])); string s = Hashes.BinaryToString(Digest); Assert.AreEqual("46b9dd2b0ba88d13233b3feb743eeb243fcd52ea62b81b82b50c27646ed5762fd75dc4ddd8c0f200cb05019d67b592f6fc821c49479ab48640292eacb3b7c4be", s); }
public void Test_03_SHA3_384() { SHA3_384 H = new SHA3_384(); byte[] Digest = H.ComputeVariable(new MemoryStream(new byte[0])); string s = Hashes.BinaryToString(Digest); Assert.AreEqual("0c63a75b845e4f7d01107d852e4c2485c51a50aaaa94fc61995e71bbee983a2ac3713831264adb47fb6bd1e058d5f004", s); }
public void Test_04_SHA3_512() { SHA3_512 H = new SHA3_512(); byte[] Digest = H.ComputeVariable(new MemoryStream(new byte[0])); string s = Hashes.BinaryToString(Digest); Assert.AreEqual("a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26", s); }
public void Test_02_SHA3_256() { SHA3_256 H = new SHA3_256(); byte[] Digest = H.ComputeVariable(new MemoryStream(new byte[0])); string s = Hashes.BinaryToString(Digest); Assert.AreEqual("a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a", s); }
public void Test_01_SHA3_224() { SHA3_224 H = new SHA3_224(); byte[] Digest = H.ComputeVariable(new MemoryStream(new byte[0])); string s = Hashes.BinaryToString(Digest); Assert.AreEqual("6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7", s); }
public void Test_12_A3_TestVector_11() { // §A.3 byte[] Key = Hashes.StringToBinary("0100000000000000040000000000000000000000000000000000000000000000"); Poly1305 Authenticator = new Poly1305(Key); byte[] Data = Hashes.StringToBinary("E33594D7505E43B900000000000000003394D7505E4379CD010000000000000000000000000000000000000000000000"); byte[] Mac = Authenticator.CalcMac(Data); Assert.AreEqual("13000000000000000000000000000000", Hashes.BinaryToString(Mac)); }
public void Test_06_A3_TestVector_5() { // §A.3 byte[] Key = Hashes.StringToBinary("0200000000000000000000000000000000000000000000000000000000000000"); Poly1305 Authenticator = new Poly1305(Key); byte[] Data = Hashes.StringToBinary("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"); byte[] Mac = Authenticator.CalcMac(Data); Assert.AreEqual("03000000000000000000000000000000", Hashes.BinaryToString(Mac)); }
public void Test_05_A3_TestVector_4() { // §A.3 byte[] Key = Hashes.StringToBinary("1c9240a5eb55d38af333888604f6b5f0473917c1402b80099dca5cbc207075c0"); Poly1305 Authenticator = new Poly1305(Key); byte[] Data = Hashes.StringToBinary("2754776173206272696c6c69672c20616e642074686520736c6974687920746f7665730a446964206779726520616e642067696d626c6520696e2074686520776162653a0a416c6c206d696d737920776572652074686520626f726f676f7665732c0a416e6420746865206d6f6d65207261746873206f757467726162652e"); byte[] Mac = Authenticator.CalcMac(Data); Assert.AreEqual("4541669a7eaaee61e708dc7cbcc5eb62", Hashes.BinaryToString(Mac)); }
public void Test_02_A3_TestVector_1() { // §A.3 byte[] Key = new byte[32]; Poly1305 Authenticator = new Poly1305(Key); byte[] Data = new byte[64]; byte[] Mac = Authenticator.CalcMac(Data); Assert.AreEqual("00000000000000000000000000000000", Hashes.BinaryToString(Mac)); }
public void Test_04_A3_TestVector_3() { // §A.3 byte[] Key = Hashes.StringToBinary("36e5f6b5c5e06070f0efca96227a863e00000000000000000000000000000000"); Poly1305 Authenticator = new Poly1305(Key); byte[] Data = Hashes.StringToBinary("416e79207375626d697373696f6e20746f20746865204945544620696e74656e6465642062792074686520436f6e7472696275746f7220666f72207075626c69636174696f6e20617320616c6c206f722070617274206f6620616e204945544620496e7465726e65742d4472616674206f722052464320616e6420616e792073746174656d656e74206d6164652077697468696e2074686520636f6e74657874206f6620616e204945544620616374697669747920697320636f6e7369646572656420616e20224945544620436f6e747269627574696f6e222e20537563682073746174656d656e747320696e636c756465206f72616c2073746174656d656e747320696e20494554462073657373696f6e732c2061732077656c6c206173207772697474656e20616e6420656c656374726f6e696320636f6d6d756e69636174696f6e73206d61646520617420616e792074696d65206f7220706c6163652c207768696368206172652061646472657373656420746f"); byte[] Mac = Authenticator.CalcMac(Data); Assert.AreEqual("f3477e7cd95417af89a6b8794c310cf0", Hashes.BinaryToString(Mac)); }
private void RandomizePassword(HttpRequest Request, HttpResponse Response) { using (RandomNumberGenerator Gen = RandomNumberGenerator.Create()) { byte[] Bin = new byte[32]; Gen.GetBytes(Bin); Response.StatusCode = 200; Response.ContentType = "text/plain"; Response.Write(Hashes.BinaryToString(Bin)); } }
public void Test_03_A1_TestVector_1() { // .1 byte[] Key = new byte[32]; byte[] Nonce = new byte[12]; uint BlockCount = 0; ChaCha20 Cipher = new ChaCha20(Key, BlockCount, Nonce); byte[] Result = Cipher.GetBytes(64); Assert.AreEqual("76b8e0ada0f13d90405d6ae55386bd28bdd219b8a08ded1aa836efcc8b770dc7da41597c5157488d7724e03fb8d84a376a43b8f41518a11cc387b669b2ee6586", Hashes.BinaryToString(Result)); }
public void Test_04_A1_TestVector_2() { // .1 byte[] Key = new byte[32]; byte[] Nonce = new byte[12]; uint BlockCount = 1; ChaCha20 Cipher = new ChaCha20(Key, BlockCount, Nonce); byte[] Result = Cipher.GetBytes(64); Assert.AreEqual("9f07e7be5551387a98ba977c732d080dcb0f29a048e3656912c6533e32ee7aed29b721769ce64e43d57133b074d839d531ed1f28510afb45ace10a1f4b794d6f", Hashes.BinaryToString(Result)); }