First, I used OpenSSL to create a public key(modulus, e), then a text file is encrypted with the public key.

Second, I inputed modulus and e(from 'First') at http://nmichaels.org/rsa.py, then using the URL to encrypt the same text file.

However, the encrypted results are **different**! Could someone give me some explanations? Thanks.

**Step1**: Using OpenSSL to create a public key below(Modulus, e,d)

openssl rsa -in mykey.pem -pubout -out mykey.pub

Modulus (81 bytes)

```
00
da ff 24 57 07 8a 4c b8 63 79 79 ff 55 27 10 b5
0f 6c ab 0e 17 dc 05 1a d3 4f 85 77 6c a6 89 37
8c 83 11 3d 5e 11 15 4b 34 5e 5c dd fd 3f a6 dc
6e 3e ff 97 be 5b 49 2a 78 10 f1 bf 80 d6 09 36
34 bd 99 5f 40 d6 1c 41 8d 3a d8 75 b9 53 b2 40
fb e6 97 72 31 f7 bf 81 5e 75 04 e7 35 0d 98 3b
54 83 3f 9d e8 66 3b e6 2f c9 63 98 63 9f d7 88
99 85 75 d1 21 24 e9 1a 9e 3c da 41 7e 92 5f e1
```

e (3 bytes)

```
01 00 01
```

**Step 2**: created a text file(1.txt),which contains(Hex view):

```
31 32 33 20 0D 0A
```

**Step 3**:
Using public key(mykey.pub) to encrypt the text file(1.txt),

openssl rsautl -encrypt -pubin -inkey mykey.pub -in 1.txt -out encry.txt

However,the encrypted result is different from nmichaels.org/rsa.py, as follows,

1)encry.txt:

```
4B 61 95 C5 17 62 E4 21 53 BB 81 F4 B3 2C FB 52
D3 7D EA 11 E2 BC FD 31 11 72 49 9D E5 E4 E8 BD
3F 4F 9E C0 9A C8 69 B5 EA 49 37 47 65 37 F8 FC
56 65 77 94 75 90 13 07 38 9C F7 65 C2 DB 47 D5
57 9E 26 A2 73 CC 43 67 D7 A9 83 B0 82 17 4A 2D
B3 7E 85 D6 70 11 9D D2 6C EF 36 D8 67 8B 3E 63
50 45 CC 49 1B DF FB 29 71 05 CE F7 4F A7 E8 41
FA DB 9F DE A6 B3 40 1C 48 E0 C7 7B F8 47 B7 D0
```

2)http://nmichaels.org/rsa.py returns a distinguish result,

```
0xb5 0xfc 0xcb 0x8 0xbe 0x20 0xcf 0x74 0xab 0xbb 0xd 0x5d 0x11 0x66 0xba 0x15 0x86 0x65 0x57 0xb9 0x2e 0x5a 0x96 0x83 0x2b 0xce 0x9b 0xda 0xbb 0x21 0x8f 0xc1 0x62 0x2e 0xf5 0x2 0xc9 0x61 0xdd 0x73 0x7d 0x3f 0x39 0x5f 0x43 0xeb 0xf8 0x3b 0x1c 0xca 0xc4 0xab 0xcf 0x5a 0x6e 0xbe 0xae 0x6d 0x91 0xee 0x7a 0x28 0x55 0x91 0xb9 0xca 0x5c 0x1 0x58 0xe7 0x4e 0xb8 0x27 0x51 0xca 0x1a 0xfa 0x77 0x93 0xd8 0x8c 0x9b 0x74 0x30 0xc3 0x66 0x2f 0xbd 0xd7 0x34 0x25 0x95 0xaf 0xe2 0xa4 0x33 0x59 0xf8 0xd0 0xfd 0x99 0x48 0xd3 0x14 0x30 0x5b 0x53 0x7e 0xc3 0x3e 0x22 0x91 0xff 0x42 0x8d 0x8e 0x4f 0xf4 0xe6 0x55 0x6e 0x7c 0xa6 0xff 0x9b 0xbd 0xb 0xb0
```

I guess OpenSSL's result is correct, but I don't know why get two different results.

`-raw`

parameter. – mikeazo Sep 15 at 12:46