Skip to content

Instantly share code, notes, and snippets.

@jhuamanchumo
jhuamanchumo / CryptoUtil.html
Last active October 14, 2021 19:49
AES Encryption - JavaScript
View CryptoUtil.html
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.min.js"></script>
</head>
<body>
<script>
@jhuamanchumo
jhuamanchumo / CryptoUtil.cs
Created October 14, 2021 19:42
AES Encryption - C#
View CryptoUtil.cs
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace CryptoUtil
{
class CryptoUtil
{
static String SECRET_KEY = "secretKey";
@jhuamanchumo
jhuamanchumo / CryptoUtil.py
Created October 14, 2021 17:30
AES Encryption - Python
View CryptoUtil.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import base64
from Crypto.Util import Padding
from Crypto.Cipher import AES
def encrypt(plain_text, key, iv):
try:
@jhuamanchumo
jhuamanchumo / CryptoUtil.java
Created October 14, 2021 17:25
AES Encryption - Java
View CryptoUtil.java
package com.example.util;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.security.InvalidAlgorithmParameterException;
@jhuamanchumo
jhuamanchumo / python-multiprocessing.py
Created October 13, 2021 21:27
Python multiprocessing example
View python-multiprocessing.py
import multiprocessing as mp
import time
result_list_pool = []
result_list_process = []
def foo_pool(x):
time.sleep(2)
return x*x