Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

tangsw cntsw

🎯
Focusing
Block or report user

Report or block cntsw

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View install_openresty_in_mac.md

Install 3scale self managed API gateway (openresty) in Mac OS-X

brew update
brew install pcre openssl

wget http://openresty.org/download/ngx_openresty-1.9.7.2.tar.gz
tar xzvf ngx_openresty-1.9.7.2.tar.gz
cd ngx_openresty-1.9.7.2
@cntsw
cntsw / RsaTest.java
Created Mar 9, 2019
Rea Arithmetic Java Demo
View RsaTest.java
public class RsaTest {
private static final BigInteger N1 = new BigInteger("-1"); // -1
public void test() {
int keyByteLen = 128 / 8;
BigInteger p = new BigInteger("fd6a04e98167dfa3", 16);
BigInteger q = new BigInteger("d6b703bcfe619b63", 16);
BigInteger n = p.multiply(q); // 0x282522173461889495699110463826178747657
BigInteger phi = p.add(N1).multiply(q.add(N1)); // phi = (q-1) * (p-1) d48bca9808d27e0d47237bf3e68cb204
BigInteger e = new BigInteger("65537");
@cntsw
cntsw / encrypt_openssl.md
Created Mar 9, 2019 — forked from dreikanter/encrypt_openssl.md
File encryption using OpenSSL
View encrypt_openssl.md

Symmetic encryption

For symmetic encryption, you can use the following:

To encrypt:

openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt

To decrypt:

You can’t perform that action at this time.