ตอนนี้ฉันมีปัญหากับ RSA ฉันมีโมดูลัสและเลขชี้กำลังเหมือนกันใน Javascript และ PHP ทั้งคู่ใช้ PKCS#1 ใน javascript ฉันใช้ http://www-cs-students.stanford.edu/~tjw/jsbn/rsa.js
var rsa = new RSAKey();
rsa.setPublic("modulus","ex");
var result = rsa.encrypt(text);
และใน PHP ฉันใช้ http://phpseclib.sourceforge.net/
require_once 'Crypt/RSA.php';
$rsa = new Crypt_RSA();
$n="modulus";
$e="ex";
$rsa->modulus= new Math_BigInteger($n,16);
$rsa->publicExponent= new Math_BigInteger($e,16);
$key=$rsa->getPublicKey();
$rsa->loadKey($key);
$rsa->setEncryptionMode(CRYPT_RSA_ENCRYPTION_PKCS1);
$ciphertext = $rsa->encrypt("1234");
echo bin2hex($ciphertext);
แต่ผลลัพธ์ 2 อย่างแตกต่างกัน มีใครช่วยบอกเหตุผลหน่อยได้ไหม ขอบคุณมาก