summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2021-05-24 12:06:38 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2021-05-24 12:06:38 +0700
commit4f2f534a617446f13c42dd6f775357272b4511a9 (patch)
treeed15db6c62829a895a0c117290b1835b109c055e
parentgithub #222 addressed OAEP parameter setting, refactored KeyTransRecipientInf... (diff)
downloadBouncyCastle.NET-ed25519-4f2f534a617446f13c42dd6f775357272b4511a9.tar.xz
Use DigestSink
-rw-r--r--crypto/src/crypto/tls/DigestInputBuffer.cs24
1 files changed, 2 insertions, 22 deletions
diff --git a/crypto/src/crypto/tls/DigestInputBuffer.cs b/crypto/src/crypto/tls/DigestInputBuffer.cs
index 4435b40a5..acc6756e4 100644
--- a/crypto/src/crypto/tls/DigestInputBuffer.cs
+++ b/crypto/src/crypto/tls/DigestInputBuffer.cs
@@ -1,6 +1,7 @@
 using System;
 using System.IO;
 
+using Org.BouncyCastle.Crypto.IO;
 using Org.BouncyCastle.Utilities.IO;
 
 namespace Org.BouncyCastle.Crypto.Tls
@@ -10,28 +11,7 @@ namespace Org.BouncyCastle.Crypto.Tls
     {
         internal void UpdateDigest(IDigest d)
         {
-            Streams.WriteBufTo(this, new DigStream(d));
-        }
-
-        private class DigStream
-            :   BaseOutputStream
-        {
-            private readonly IDigest d;
-
-            internal DigStream(IDigest d)
-            {
-                this.d = d;
-            }
-
-            public override void WriteByte(byte b)
-            {
-                d.Update(b);
-            }
-
-            public override void Write(byte[] buf, int off, int len)
-            {
-                d.BlockUpdate(buf, off, len);
-            }
+            Streams.WriteBufTo(this, new DigestSink(d));
         }
     }
 }