生成SHA1哈希便携式类库 [英] Generate SHA1 Hash in Portable Class Library
问题描述
我试图建立一个便携式类库产生的OAuth网址,其他类/应用程序中使用。这个类库使用OAuth必须是一个便携式类库,因此它可与不同版本的DropBox的API我建立的工作。
I'm trying to build a portable class library that generates OAuth urls for other classes/applications to use. This class library using OAuth has to be a portable class library so it can work with different versions of a DropBox API I'm building.
本类的一部分,需要生成一个SHA1哈希生成与oauth_signature。
Part of this class needs to generate an SHA1 hash to generate the oauth_signature with.
我知道,便携式类库不支持System.Security.Cryptography,所以反正是有这个类可以没有该类生成SHA1哈希?
I'm aware that portable class library doesn't support System.Security.Cryptography, so is there anyway that this class can generate an SHA1 hash without that class?
推荐答案
单提供的managed实施它自己的SHA1 的 mscorlib.dll中
(但它不是位于 Mono.Security.dll
像@CodeInChaos建议)。
Mono provides a managed implementation of SHA1 for it's own mscorlib.dll
(but it's not located in Mono.Security.dll
like @CodeInChaos suggested).
它是开源的,很好的测试,这意味着它们的行为与微软实现(例如,从 SHA1
, HashAlgorith
派生工具... ICryptoTransform的
...),所以它应该是一个简单直接替换。
It's open source, very well tested and meant to behave exactly like Microsoft implementation (e.g. it derives from SHA1
, HashAlgorith
... implements ICryptoTransform
...) so it should be an easy drop-in replacement.
这篇关于生成SHA1哈希便携式类库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!