如何读取此功能以及从RSA计算中获得的功能 [英] how to read this function and which is obtained from the calculation of RSA

查看:50
本文介绍了如何读取此功能以及从RSA计算中获得的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

RSACryptoServiceProvider rsaCryptoServiceProvider = 
    new RSACryptoServiceProvider(dwKeySize);
rsaCryptoServiceProvider.FromXmlString(xmlString);
int keySize = dwKeySize / 8;
byte[] bytes = Encoding.UTF32.GetBytes(inputString);
/* The hash function in use by the .NET RSACryptoServiceProvider here is SHA1
 * int maxLength = keySize - 2 - 2 * SHA1.Create().ComputeHash(rawBytes).Length; */
int maxLength = keySize - 42;

推荐答案

我明白了-你不断地问同样的事情.很好.

从注释的代码中可以清楚地看到maxLength可以具有一定范围的值,因此选择42可能是任意的.
I see - you''re asking the same things over and over. Great.

It''s clear from the commented code that maxLength can have a range of values, so the choice of 42 may well be arbitrary.


SHA1的哈希值有20个字节.因此,它的长度是20.然后:
The hash of SHA1 has 20 bytes. So, its length is 20. Then:
// int maxLength = keySize - 2 - 2 * SHA1.Create().ComputeHash(rawBytes).Length;
// int maxLength = keySize - 2 - 2 * 20;
int maxLength = keySize - 42

就这些.


这篇关于如何读取此功能以及从RSA计算中获得的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆