This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.crypto.Cipher; | |
import java.io.InputStream; | |
import java.security.*; | |
import java.util.Base64; | |
import static java.nio.charset.StandardCharsets.UTF_8; | |
import java.security.spec.X509EncodedKeySpec; | |
public class RsaExample { | |
public static KeyPair generateKeyPair() throws Exception { | |
KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.yeshen.download; | |
import android.os.Handler; | |
import android.os.HandlerThread; | |
import android.os.Looper; | |
import android.support.annotation.Nullable; | |
import android.support.annotation.UiThread; | |
import android.support.annotation.WorkerThread; | |
import android.util.Log; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.yeshen.download; | |
import android.support.annotation.WorkerThread; | |
import android.text.TextUtils; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.math.BigInteger; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.yeshen.utils; | |
import android.support.annotation.WorkerThread; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.InputStream; | |
import java.security.MessageDigest; | |
/********************************************************************* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validate_rid(id) { | |
// 18位身份证号 | |
// 国家标准《GB 11643-1999》 | |
function rid18(id) { | |
if(! /\d{17}[\dxX]/.test(id)) { | |
return false; | |
} | |
var modcmpl = function(m, i, n) { return (i + n - m % i) % i; }, | |
f = function(v, i) { return v * (Math.pow(2, i-1) % 11); }, | |
s = 0; |