我正在尝试制作一个脚本,可以在Windows机器上加扰文件夹文件和文件内容.
这是我第一次尝试在文件夹中加密文件名.我知道表现明智它可能很糟糕,它看起来很可怜,但我是新的,并试图教给我自己.
import os
import sys
import re
root = 'C:/Users/Any/Desktop/test'
for item in os.listdir(root):
fullpath = os.path.join(root, item)
os.rename(fullpath, fullpath.replace(' A', ' ?'))
for item in os.listdir(root):
fullpath = os.path.join(root, item)
os.rename(fullpath, fullpath.replace(' B', ' ?'))
for item in os.listdir(root):
fullpath = os.path.join(root, item)
os.rename(fullpath, fullpath.replace(' C', ' ?'))
for item in os.listdir(root):
fullpath = os.path.join(root, item)
os.rename(fullpath, fullpath.replace(' D', '?'))
for item in os.listdir(root):
fullpath = os.path.join(root, item)
os.rename(fullpath, fullpath.replace(' E', '?'))
for item in os.listdir(root):
fullpath = …Run Code Online (Sandbox Code Playgroud) 我从Internet获得了一段代码,使用TripleDES加密我的数据.
$key = "ThisIsTheKey"; // 24 bit Key
$iv = "fYfhHeDm"; // 8 bit IV
$bit_check = 8; // bit amount for diff algor.
//function to encrypt
function encrypt($text) {
global $key,$iv,$bit_check;
$text_num = str_split($text, $bit_check);
$text_num = $bit_check - strlen($text_num[count($text_num) - 1]);
for ($i = 0; $i < $text_num; $i++) {
$text = $text . chr($text_num);
}
$cipher = mcrypt_module_open(MCRYPT_TRIPLEDES, '', 'cbc', '');
mcrypt_generic_init($cipher, $key, $iv);
$decrypted = mcrypt_generic($cipher, $text);
mcrypt_generic_deinit($cipher);
return base64_encode($decrypted);
}
Run Code Online (Sandbox Code Playgroud)
问题是即使我将变量称为全局变量,在顶部(我声明变量)显示变量未使用.当我尝试运行它时,它给出了一个错误.但是,当我在函数内部声明相同的变量时,它可以工作.
我有oracle数据库移动到新的postgresql服务器.
有些表具有字段sesitive,并且这些表都通过DBMS_OBFUSCATION_TOOLKIT.DESENCRYPT/DESDECRYPT加密.
问题出在这里.postgresql的加密数据大小(bytea类型)的大小应该与oracle相同.
我试图用aes(加密/解密)完成它,它比原始数据大约三倍.(oracle使用des算法需要16byte,postgresql使用aes需要33byte,原始数据需要13byte.)
我也尝试了postgresql crypt,但是手册没有提到解密它的方式,限制了8byte的原始数据大小.
现在我真的需要加密方法,它采用尽可能小的加密数据大小并提供解密方法.
有没有好办法或其他选择?提前致谢.
SecureRandom random = new SecureRandom(); // quite heavy, look into a lighter method.
String stringToEncrypt = "mypassword";
byte[] realiv = new byte[16];
random.nextBytes(realiv);
Cipher ecipher = Cipher.getInstance("AES");
SecureRandom random = new SecureRandom(); // quite heavy, look into a lighter method.
byte[] realiv = new byte[16];
random.nextBytes(realiv);
byte[] secret = "somelongsecretkey".getBytes();
SecretKeySpec secretKey = new SecretKeySpec(secret, "AES");
ecipher.init(Cipher.ENCRYPT_MODE, secretKey, random);
byte[] encryptedData = ecipher.doFinal();
Run Code Online (Sandbox Code Playgroud)
但init()唯一需要3个参数.我需要一种方法来做类似的事情:
ecipher.init(Cipher.ENCRYPT_MODE, stringToEncrypt, secretKey, random);
Run Code Online (Sandbox Code Playgroud) 任何人都可以建议通过许可证密钥或其他任何方式实现应用程序的复制保护的最佳方法.
那里有标准的API吗?或者编写自己的标准做法是什么?如果是这样,那里有没有任何教程演示如何实现它?
我在我的IIS/MVC4网站上将JSON结果发送回javascript(Jquery).json包含大约60-100个字母的字符串值.
目前,它是以明文形式发送的,根本没有加密.
在javascript客户端和.net C#后端之间加密这条消息最简单的方法是什么?
加密剂量必须非常好,但足以让你在1小时内无法计算/暴露内容.
请记住,每个人都有JavaScript,所以我不能只为所有客户使用公共密钥.
我正在考虑RSA加密的一些内容,客户端生成密钥对并将其公钥与请求一起发回,服务器使用它来加密值.我无法找到任何这样的例子,所以我非常愿意接受建议.
如果密码在ajax之前加密,那么阻止黑客捕获加密密码并使用它登录的是什么?
是否应事先从后端发送独特的盐?
黑客也不能捕获它吗?
我的问题的背景:
我完成了本教程
http://www.wikihow.com/Create-a-Secure-Login-Script-in-PHP-and-MySQL
教程
浏览器端的加密密码,然后将密码发送到后端它存储在db中
从那个链接开始,第一条评论在我脑海中浮现,
"什么是阻止黑客获取哈希密码并登录?"
我需要读取用户输入和用户Caesar cypher来加密它.但是在阅读用户输入时我遇到了以下问题,如果我输入例如我的程序没有终止:" ./caesar 3 I'm"问题似乎是字符'.该程序适用于其他输入.
/**
*
* caesar.c
*
* The program caesar encrypts a String entered by the user
* using the caesar cipher technique. The user has to enter
* a key as additional command line argument. After that the
* user is asked to enter the String he wants to be encrypted.
*
* Usage: ./caesar key [char]
*
*/
#include <cs50.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int caesarCipher(char original, …Run Code Online (Sandbox Code Playgroud) 大家好我正在制作一个perl脚本来加密和解密文本,我刚刚开始我有这个:
#!/usr/bin/perl
use Crypt::IDEA;
my $key = pack("H32", "0123456789ABCDEF0123456789ABCDEF");
my $cipher = new IDEA $key;
my $palabra= "plaintex";
my $ciphertext = $cipher->encrypt($palabra); # NB - 8 bytes
print unpack("H16", $ciphertext), "\n";
my $plaintext = $cipher->decrypt($ciphertext);
print $plaintext , "\n";
Run Code Online (Sandbox Code Playgroud)
麻烦的是加密的文本必须是8个字节的长度.为什么?如果我把"明文"代替"plaintex"给我错误.
input must be 8 bytes long at /usr/lib/perl5/site_perl/Crypt/IDEA.pm line 62.
Run Code Online (Sandbox Code Playgroud) 目前我在Java中使用加密实例,如下所示:
Cipher cipher = Cipher.getInstance("RSA");
Run Code Online (Sandbox Code Playgroud)
但我无法在OpenSSL中解密我的加密消息,我想使用RSA_PKCS1_OAEP_PADDING.我需要添加什么"RSA"才能使用RSA_PKCS1_OAEP_PADDING?
请帮忙