简体   繁体   中英

Simple asymmetric encryption algorithm

I want to implement simple asymmetric encryption algorithm using javascript (or reuse open library). I don't want to use RSA (or other algorithms), because they are complicated. All I want to do is illustrated in following pseudo code:

var encryptor = new AsymEncript();
var encrypted = encryptor.encrypt("hello world", "public key string");
var decrypted = encryptor.decrypt(encrypted, "private secret key");

I don't want to deal with complicated libraries such as pidCrypt, jsencrypt. I need a really simple algorithm, which allow me to create public\\private key pair. Then I can use this pair for encryption.
Can you point me out to some articles or some ideas how this can be implemented?

From your equations:
f(x)=x*pubKey
g(m)=m*pKey
g(f(x))=x

You arrive at this:
x=f(x)*pKey => x=x*pubKey*pKey => pubKey = 1/pKey

This seems like a very weak algorithm (unless I misunderstood you somehow).

If you really care about your security, you should go with some wrapper library that does RSA (or some other algorithm) for you in a simple manner.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM