PointyCastle / pointycastle

Moved into the Bouncy Castle project: https://github.com/bcgit/pc-dart
MIT License
270 stars 76 forks source link

rsa encrypt is different to python's way #150

Open sidealice opened 6 years ago

sidealice commented 6 years ago

modulus 165138424261149263963666229661164814908887524950166142962960019363944425161240370251403452452001165143400173133423045791330687304650944332950460079059702342999940532642226896299225258939028313437520982527474148958262129523279095471616009516621824844891755906467794220597075349492626446841979774101805104112707 publicExponent 65537 string 1536006072 IYVC6K 8217B8E9C6100000

PointyCastle result: b28e6550000bb52f787a3372021c6db670e2341bc15c2e77ebe62dfeb1f01a52446880bf624ba5613e2a7cf95dca20d5ca00ced959d5b99b9f2ae0436838310e102920326aca61ad4887a9e1ce74b5fdc1c346d16e685a8d220db75679eb54f101ee838dfea2f8743497f86c7c8c7ff1db95b60eca8027c9a2c62d90f1adea67 python result(hex): 664a6ee5865ec57746b5d547b84c7ca35b45053e36f9bf41ba062815c14bfe7143f747dd9318c1157b55203de6fe3a0dc5a2e6568ca8dcab918422b22f77c88c5ceb826587563f195a6954605c1f5b8e98fce4708250b5a4db9c47177bd76c95e18c9eace59d25026c6fea72d08fda2a825411e5470158dde93963d6b907ac4b

should i change some config or where i can change the config.

duncanhoggan commented 5 years ago

Please provide the code samples you are using and information about your system.

Note if you are using a padding scheme (as you should) the encryption result will never be the same. Padding schemes such as OAEP and PKCS1 use a random seed so the results should not be the same.