iv

Android -- 补间动画

大城市里の小女人 提交于 2020-02-24 11:59:28
补间动画的优点是可以节省空间。补间动画与逐帧动画在本质上是不同的,逐帧动画通过连续播放图片来模拟动画的效果,而补间动画则是通过在两个关键帧之间补充渐变的动画效果来实现的。目前Android应用框架支持的补间动画效果有以下5种。具体实现在android.view.animation类库中。 AlphaAnimation:透明度(alpha)渐变效果,对应<alpha/>标签。 TranslateAnimation:位移渐变,需要指定移动点的开始和结束坐标,对应<translate/>标签。 ScaleAnimation:缩放渐变,可以指定缩放的参考点,对应<scale/>标签。 RotateAnimation:旋转渐变,可以指定旋转的参考点,对应<rotate/>标签。 AnimationSet:组合渐变,支持组合多种渐变效果,对应<set/>标签。 补间动画的效果同样可以使用XML语言来定义,这些动画模板文件通常会被放在Android项目的res/anim/目录下。 主代码 public class MainActivity extends Activity { private ImageView iv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate

前端使用crypto-js进行加解密

烂漫一生 提交于 2020-01-27 08:04:48
import CryptoJS from 'crypto-js' export const crypto = { options() { return { key: CryptoJS.enc.Utf8.parse('asdfghjklqwe'), iv: CryptoJS.enc.Utf8.parse('123') } },//加密 getAES(data) { const { key, iv } = this.options() const encrypted = CryptoJS.AES.encrypt(data, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }) return encrypted.toString() },//解密 getDAes(encrypted) { const { key, iv } = this.options() const decrypted = CryptoJS.AES.decrypt(encrypted, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }) return decrypted.toString(CryptoJS.enc.Utf8) }} 来源:

前端使用crypto-js进行加解密

这一生的挚爱 提交于 2020-01-04 03:35:02
import CryptoJS from 'crypto-js' export const crypto = { options() { return { key: CryptoJS.enc.Utf8.parse('asdfghjklqwe'), iv: CryptoJS.enc.Utf8.parse('123') } },//加密 getAES(data) { const { key, iv } = this.options() const encrypted = CryptoJS.AES.encrypt(data, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }) return encrypted.toString() },//解密 getDAes(encrypted) { const { key, iv } = this.options() const decrypted = CryptoJS.AES.decrypt(encrypted, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }) return decrypted.toString(CryptoJS.enc.Utf8) }} 来源:

Python计算IV值

匿名 (未验证) 提交于 2019-12-02 22:51:30
更多风控建模、大数据分析等内容请关注公众号《大数据风控的一点一滴》 在对变量分箱后,需要计算变量的重要性,IV是评估变量区分度或重要性的统计量之一,python计算IV值的代码如下: def CalcIV(Xvar, Yvar): N_0 = np.sum(Yvar==0) N_1 = np.sum(Yvar==1) N_0_group = np.zeros(np.unique(Xvar).shape) N_1_group = np.zeros(np.unique(Xvar).shape) for i in range(len(np.unique(Xvar))): N_0_group[i] = Yvar[(Xvar == np.unique(Xvar)[i]) & (Yvar == 0)].count() N_1_group[i] = Yvar[(Xvar == np.unique(Xvar)[i]) & (Yvar == 1)].count() iv = np.sum((N_0_group/N_0 - N_1_group/N_1) * np.log((N_0_group/N_0)/(N_1_group/N_1))) return iv def caliv_batch(df, Kvar, Yvar): df_Xvar = df.drop([Kvar, Yvar], axis=1)

兼容php5和php7 openssl_encrypt AES-128-CBC

匿名 (未验证) 提交于 2019-12-02 22:11:45
直接上个类吧 <?php /** * Created by PhpStorm. * User: Administrator * Date: 2019/7/25 * Time: 17:53 */ /** * @desc:php aes加密解密类 * @author [Lee] <[<complet@163.com>]> */ class aes{ // 加密方式:1、mcrypt;2、openssl 默认1 private $type; // cast-128 gost rijndael-128 twofish cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes arcfour // AES-128-CBC AES-128-CFB AES-128-CFB1 AES-128-CFB8 AES-128-CTR AES-128-ECB AES-128-OFB AES-128-XTS AES-192-CBC AES-192-CFB AES-192-CFB1 AES-192-CFB8 AES-192-CTR AES-192-ECB AES-192-OFB AES-256-CBC AES-256-CFB AES

PHP实现AES加密解密

两盒软妹~` 提交于 2019-12-02 21:30:38
1、mcrypt_encrypt AES加密,解密 1 class Lib_desEnctyp 2 { 3 private $key = ""; 4 private $iv = ""; 5 6 /** 7 * 构造,传递二个已经进行base64_encode的KEY与IV 8 * 9 * @param string $key 10 * @param string $iv 11 */ 12 function __construct ($key, $iv) 13 { 14 if (empty($key) || empty($iv)) { 15 echo 'key and iv is not valid'; 16 exit(); 17 } 18 $this->key = $key; 19 $this->iv = $iv; 20 } 21 22 /** 23 *加密 24 * @param <type> $value 25 * @return <type> 26 */ 27 public function encrypt ($value) 28 { 29 $td = mcrypt_module_open(MCRYPT_3DES, '', MCRYPT_MODE_CBC, ''); 30 $iv = base64_decode($this->iv); 31 $value = $this-

OpenSSL::Cipher.new 加密解密

吃可爱长大的小学妹 提交于 2019-11-27 02:15:47
https://cloud.tencent.com/developer/section/1379183 OpenSSL::Cipher.new application_controller.rb def decrypter(data) key = ENV['ENCRYPTION_KEY'] iv = ENV['ENCRYPTION_IV'] decipher = OpenSSL::Cipher.new('des3') decipher.decrypt decipher.key = key decipher.iv = iv decipher.update(Base64.decode64(data)) + decipher.final end module aaaService def self.encrypt(plain_text) cipher = OpenSSL::Cipher.new('AES-128-CBC') cipher.encrypt cipher.key = Base64.decode64(ENV['MIDDLxxxx_ENCRYPTION_KEY']) cipher.iv = iv = cipher.random_iv encrypted = cipher.update(plain_text) + cipher.final final_string = iv +