public void CommitPublicNonces(IEnumerable <GroupElement> nonces)
    {
        var nonceArray = nonces.ToArray();

        var label    = Encoding.UTF8.GetBytes("nonce-commitment");
        var metadata = Enumerable.Concat(label, BitConverter.GetBytes(nonceArray.Length)).ToArray();

        _strobe.AddAssociatedMetaData(metadata, false);

        for (var i = 0; i < nonceArray.Length; i++)
        {
            metadata = Enumerable.Concat(BitConverter.GetBytes(i), BitConverter.GetBytes(33)).ToArray();
            _strobe.AddAssociatedMetaData(metadata, false);
            _strobe.AddAssociatedData(nonceArray[i].ToBytes(), false);
        }
    }
Esempio n. 2
0
        public TestTranscript(byte[] label)
        {
            _strobe = new Strobe128("WabiSabi_v1.0");

            var metadata = Enumerable.Concat(Encoding.UTF8.GetBytes("domain-separator"), BitConverter.GetBytes(label.Length)).ToArray();

            _strobe.AddAssociatedMetaData(metadata, false);
            _strobe.AddAssociatedData(label, false);
        }
    public TestTranscript(byte[] label)
    {
        _strobe = new Strobe128(ProtocolConstants.WabiSabiProtocolIdentifier);

        var metadata = Enumerable.Concat(
            Encoding.UTF8.GetBytes(ProtocolConstants.DomainStrobeSeparator),
            BitConverter.GetBytes(label.Length)).ToArray();

        _strobe.AddAssociatedMetaData(metadata, false);
        _strobe.AddAssociatedData(label, false);
    }
Esempio n. 4
0
 // Generate Fiat Shamir challenges
 public Scalar GenerateChallenge()
 {
     _strobe.AddAssociatedMetaData(ChallengeTag, false);
     return(new Scalar(_strobe.Prf(KeySizeInBytes, false)));
 }