Skip to content

Commit 7ca16fc

Browse files
vcsjonesbartonjs
andauthored
Fix HMAC docs to use hash output size, not block size, for key adjustment (#8918)
* Fix HMAC docs to use hash output size, not block size, for key adjustment * Review feedback * Add back missing word --------- Co-authored-by: Jeremy Barton <[email protected]>
1 parent 8d9b19a commit 7ca16fc

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

xml/System.Security.Cryptography/HMACMD5.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@
191191
<Parameter Name="key" Type="System.Byte[]" />
192192
</Parameters>
193193
<Docs>
194-
<param name="key">The secret key for <see cref="T:System.Security.Cryptography.HMACMD5" /> encryption. The key can be any length, but if it is more than 64 bytes long it will be hashed (using SHA-1) to derive a 64-byte key. Therefore, the recommended size of the secret key is 64 bytes.</param>
194+
<param name="key">The secret key for HMAC computation. The key can be any length, but if it is more than 64 bytes long it will be hashed (using MD5) to derive a 16-byte key. Therefore, the recommended size of the secret key is 64 bytes.</param>
195195
<summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.HMACMD5" /> class by using the specified key.</summary>
196196
<remarks>
197197
<format type="text/markdown"><![CDATA[

xml/System.Security.Cryptography/HMACSHA1.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@
196196
<Parameter Name="useManagedSha1" Type="System.Boolean" Index="1" FrameworkAlternate="net-5.0;net-6.0;net-7.0;net-8.0;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
197197
</Parameters>
198198
<Docs>
199-
<param name="key">The secret key for <see cref="T:System.Security.Cryptography.HMACSHA1" /> encryption. The key can be any length, but if it is more than 64 bytes long, it is hashed (using SHA-1) to derive a 64-byte key. Therefore, the recommended size of the secret key is 64 bytes.</param>
199+
<param name="key">The secret key for HMAC computation. The key can be any length, but if it is more than 64 bytes long, it is hashed (using SHA-1) to derive a 20-byte key. Therefore, the recommended size of the secret key is 64 bytes.</param>
200200
<param name="useManagedSha1">
201201
<see langword="true" /> to use the managed implementation of the SHA1 algorithm (the <see cref="T:System.Security.Cryptography.SHA1Managed" /> class); <see langword="false" /> to use the unmanaged implementation (the <see cref="T:System.Security.Cryptography.SHA1CryptoServiceProvider" /> class).</param>
202202
<summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.HMACSHA1" /> class with the specified key data and a value that specifies whether to use the managed version of the SHA1 algorithm.</summary>

xml/System.Security.Cryptography/HMACSHA256.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@
183183
<Parameter Name="key" Type="System.Byte[]" />
184184
</Parameters>
185185
<Docs>
186-
<param name="key">The secret key for <see cref="T:System.Security.Cryptography.HMACSHA256" /> encryption. The key can be any length. However, the recommended size is 64 bytes. If the key is more than 64 bytes long, it is hashed (using SHA-256) to derive a 64-byte key.</param>
186+
<param name="key">The secret key for HMAC computation. The key can be any length. However, the recommended size is 64 bytes. If the key is more than 64 bytes long, it is hashed (using SHA-256) to derive a 32-byte key.</param>
187187
<summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.HMACSHA256" /> class with the specified key data.</summary>
188188
<remarks>
189189
<format type="text/markdown"><![CDATA[

xml/System.Security.Cryptography/HMACSHA384.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
<Parameter Name="key" Type="System.Byte[]" />
188188
</Parameters>
189189
<Docs>
190-
<param name="key">The secret key for <see cref="T:System.Security.Cryptography.HMACSHA384" /> encryption. The key can be any length. However, the recommended size is 128 bytes. If the key is more than 128 bytes long, it is hashed (using SHA-384) to derive a 128-byte key.</param>
190+
<param name="key">The secret key for HMAC computation. The key can be any length. However, the recommended size is 128 bytes. If the key is more than 128 bytes long, it is hashed (using SHA-384) to derive a 48-byte key.</param>
191191
<summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.HMACSHA384" /> class by using the specified key data.</summary>
192192
<remarks>
193193
<format type="text/markdown"><![CDATA[

xml/System.Security.Cryptography/HMACSHA512.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
<Parameter Name="key" Type="System.Byte[]" />
188188
</Parameters>
189189
<Docs>
190-
<param name="key">The secret key for <see cref="T:System.Security.Cryptography.HMACSHA512" /> encryption. The key can be any length. However, the recommended size is 128 bytes. If the key is more than 128 bytes long, it is hashed (using SHA-512) to derive a 128-byte key.</param>
190+
<param name="key">The secret key for HMAC computation. The key can be any length. However, the recommended size is 128 bytes. If the key is more than 128 bytes long, it is hashed (using SHA-512) to derive a 64-byte key.</param>
191191
<summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.HMACSHA512" /> class with the specified key data.</summary>
192192
<remarks>
193193
<format type="text/markdown"><![CDATA[

0 commit comments

Comments
 (0)