RSA on JavaScript
2003 Dec 26
by www.faireal.net

This page is in Unicode, UTF-8, in English and Japanese.

What is bigint.js?

bigint.js is a general library for infinite-precision (arbitrary-precision) integer arithmetic on JavaScript. For instance, JavaScript's own Math.pow(2,100) returns this lossy value:
1.2676506002282294e+30,
while Bigint.pow(2,100) returns losslessly
126 7650600 2282294 0149670 3205376 (31-digit).

bigint.js is fast enough for many purposes (e.g. 2^10000 < 1 sec). The current status of bigint.js is v0.5 beta. No functions are documented yet.

What is PigPGP?

PigPGP is a JavaScript application implemented using bigint.js. It is a "tiny PGP", or a cryptosystem based on 128-360 bit RSA, tested on Mozilla 1.6 (slow), MSIE 6, and Netspcae 4.80. The current status of PigPGP is v0.2 beta.

Free, No Warranty

The source code is free but no warranty is provided. You can use anything, with or without modification, wihout asking. You don't even have to show the original author's name or anything to use it.

The newest version should be found at http://www.faireal.net/demo/.

The author can be reached at Liisachan (at) faireal.net. As is already said, you don't have to ask the author to do anything with these, and no support will be provided even if you ask.


PigPGP v0.2 Beta1

2003-12-26

JavaScript で実装したRSAのデモです。128~360ビットに対応しています。

鍵生成は、テスト用128ビットなら秒単位、256ビットでは10秒単位、360ビットでは1分~数分程度。 暗号化は高速です。 暗号解除が遅いです。 これは暗号化の指数が小さく(通常7か11程度)、復号化の指数が大きい(鍵サイズ程度)ためです。

[ 256-bit Sample Keys ]

PUB_PIGv2@7
@bV[H8[HB[Ii[NU:V[O{[M{8swWeyW[J3bV1z5.tf3[M$-PB]

SEC_PIGv2@6Z([F{z[La~[EU[FsK~JK[M3[B7[OB+[GGO9sp4v0!I=wW#
@bV[H8[HB[Ii[NU:V[O{[M{8swWeyW[J3bV1z5.tf3[M$-PB]

DEBUG: P = 766 4031903 0303641 1004260 1166267 (31-digit)
DEBUG: Q = 15108 5082503 5678901 7187448 0315333 7890432 9978611 (47-digit)
DEBUG: N = 1 1579208 9237931 8985674 5799819 7810828 3258143 4589403 1157013 5057229 1503976 4715137 (78-digit)

[ 360-bit Sample Keys ] (cost 30ec)
PUB_PIGv2@b
@2y[AGWsgf^p[FM9F7VJw5QRHJ[Nn[K[B^[Df`cp2p[Ky[IfrO%QpE0gJc;SkyqV]

SEC_PIGv2@1[Hfy~4[A[J/caDy[MoB[G!X6Z[Fay.fh+FDta!/$[A[J~GH,Qc2o[If[M}b6[A.[BT
@2y[AGWsgf^p[FM9F7VJw5QRHJ[Nn[K[B^[Df`cp2p[Ky[IfrO%QpE0gJc;SkyqV]

DEBUG: P = 95228 9248018 8941503 7176471 3363692 4669518 4345663 (47-digit)
DEBUG: Q = 246620 7182011 1119605 5420060 1025905 1894421 8388221 9781384 2328639 (62-digit)

DEBUG: N = 2348 5425828 1615782 5904809 4107574 5320552 5343459 8239586
 7888158 0122502 2595349 3152750 6552254 0001645 1275542 0342657 (109-digit)

前回からの更新

鍵生成のとき、IEはステータスバー、MozillaはProgressフィールドに進行状況を表示します。 -はエラトステネスのふるいではねられた。 *はふるい通過。^は強擬素数テストに1回通過。

使い方

最初に鍵ペアを作ってみてください。 次にそのうちの公開鍵を使ってテキストを暗号化してみてください。 最後に秘密鍵で暗号を解除してみてください。

Input
Public Key
Secret Key
Command
Progress
Debug

[index]