aboutsummaryrefslogtreecommitdiff
path: root/rsa.cpp
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2016-10-08 21:57:51 +0200
committertomsmeding <tom.smeding@gmail.com>2016-10-08 21:57:59 +0200
commit93b1a18fd61890eb4976a7f52d17e0990ccca661 (patch)
tree50cb66ad5dcc6c098bea1422a1237dfbefb7d65a /rsa.cpp
parent27472e604eeb74b3b60313d38d537c7e0e83151b (diff)
Fix some serious bugs with casting
Diffstat (limited to 'rsa.cpp')
-rw-r--r--rsa.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/rsa.cpp b/rsa.cpp
index 77e1350..e1bf3a8 100644
--- a/rsa.cpp
+++ b/rsa.cpp
@@ -51,8 +51,8 @@ namespace RSA{
PrivateKey importkey(const string &pub,const string &priv){
string pubdeser=Base64::decode(pub);
assert(pubdeser.size()>4);
- int modlen=(unsigned char)(pubdeser[0])+(unsigned char)(pubdeser[1]<<8)+
- (unsigned char)(pubdeser[2]<<16)+(unsigned char)(pubdeser[3]<<24);
+ int modlen=(uint8_t)pubdeser[0]+((uint8_t)pubdeser[1]<<8)+
+ ((uint8_t)pubdeser[2]<<16)+((uint8_t)pubdeser[3]<<24);
assert((int)pubdeser.size()-4>modlen);
PrivateKey key;
key.pub.mod.deserialiseMantissa(string(pubdeser.begin()+4,pubdeser.begin()+(4+modlen)));