Skip to content

Instantly share code, notes, and snippets.

@kinginblue
kinginblue / JavaAes256CbcPkcs7Demo.java
Created March 30, 2021 03:39
Java AES 256 CBC PKCS7 Demo
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
import java.security.spec.AlgorithmParameterSpec;
import java.util.Base64;
public class JavaAes256CbcPkcs7Demo {
private static final byte[] keys = new byte[]{0x2e, 0x59, 0x46, (byte) 0x93, 0x2e, (byte) 0xf2, (byte) 0x8b, (byte) 0xed, (byte) 0xcf, (byte) 0xb3, (byte) 0xc4, (byte) 0xda, (byte) 0xc2, 0x53, (byte) 0xe8, (byte) 0xbd, 0x1a, 0x33, 0x17, (byte) 0xf3, 0x35, (byte) 0xca, 0x24, 0x40, (byte) 0xa5, 0x6c, 0x5f, 0x11, 0x11, (byte) 0xfa, 0x2e, 0x1b};
@kinginblue
kinginblue / LatLonCalculator.java
Created October 18, 2017 10:47
经纬度计算器
/**
* 经纬度计算器
*/
public class LatLonCalculator {
/**
* 一纬度的距离约为:111.7 km
*/
public static final BigDecimal KM_OF_ONE_LAT = new BigDecimal(111.7);