Skip to content

Instantly share code, notes, and snippets.

View awesometic's full-sized avatar
🤔

Deokgyu Yang awesometic

🤔
  • Republic of Korea
  • 01:47 (UTC +09:00)
View GitHub Profile
@awesometic
awesometic / AES256Cipher.java
Created August 2, 2016 10:10
AES encryption example for android
/** Created by Awesometic
* references: https://gist.github.com/dealforest/1949873
* This source is updated example code of above source code.
* I added it two functions that are make random IV and make random 256 bit key.
* It's encrypt returns Base64 encoded cipher, and also decrpyt for Base64 encoded Cipher
*/
import android.util.Base64;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
@awesometic
awesometic / RSACipher.java
Last active November 23, 2024 18:44
RSA encryption example for android
/**
* Created by Awesometic
* It's encrypt returns Base64 encoded, and also decrypt for Base64 encoded cipher
* references: http://stackoverflow.com/questions/12471999/rsa-encryption-decryption-in-android
*/
import android.util.Base64;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.KeyFactory;
@awesometic
awesometic / aes256Cipher.js
Last active February 1, 2021 01:22
AES encryption example for Node.js
/**
* Created by Awesometic
* references: https://gist.github.com/ericchen/3081970
* This source is updated example code of above source code.
* I added it two functions that are make random IV and make random 256 bit key.
* It's encrypt returns Base64 encoded cipher, and also decrpyt for Base64 encoded Cipher
*/
var crypto = require('crypto');
@awesometic
awesometic / rsaCipher.js
Last active April 24, 2023 22:54
RSA encryption example for Node.js using node-rsa.
/**
* Created by Awesometic
* references: https://github.com/rzcoder/node-rsa
* RSA encryption example for Node.js with node-rsa. It's encrpyt returns Base64 encoded cipher, also decrypt for Base64 encoded cipher. RSA public key be returned in PKCS8 format.
* License for node-rsa
Copyright (c) 2014 rzcoder<br/>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.