我现在有一个 Grails 网络应用程序,它使用带有唯一盐的 SHA-256 将用户的密码存储在我的数据库中。我最近将 web 应用程序升级到 Grails(2.3.4) 的 Spring Security 插件 (2.0RC2) 的最新版本。新插件默认使用 BCrypt。我的问题是,哪个更好,为什么他们会转向 BCrypt。我读过关于喜欢 BCrypt 的人和讨厌 BCrypt 的人的文章。我看到的一个直接专业人士是算法中内置了加盐,因此我不必单独存储盐。我还注意到您可以在 SHA-256 上设置迭代。根据我的阅读,很多人喜欢 BCrypt,因为您也可以为其设置迭代,但这与设置 SHA-256 的迭代有何不同?一个博客说 PBKDF2 是一个非常优越的选择,因为它“ s 已经过测试。但我也听到了关于 BCrypt 的同样事情......
我有两台运行应用的Android设备.该应用程序使用Bump API与目标交换信息,以便提供共享密钥供以后使用.
具体地,稍后将共享秘密发送到中央服务器,然后将设备注册为"夫妇".
我想出了两种类型的解决方案,但也必须有其他解决方案.
这种情况的最佳解决方案是什么?
--EDIT--我没有尝试安全通信(我认为Bump通道足够安全).相反,我正试图找到这个特定问题的最优雅的解决方案.
根据我的理解,在安全SSL通信之前,在双方之间建立对称密钥.现在,如果SSL会话涉及不安全的无线接入点,攻击者是否有可能嗅到无线电波并获取已建立的密钥?
import string,random,platform,os,sys
def rPass():
sent = os.urandom(random.randrange(900,7899))
print sent,"\n"
intsent=0
for i in sent:
intsent += ord(i)
print intsent
intset=0
rPass()
Run Code Online (Sandbox Code Playgroud)
我需要帮助确定该算法的字节码部分的总可能输出.不要担心for循环和用于下线的ord东西. - 新手加密的家伙.
我在用PHP填写数学问题!
假设我们有:
$first = "3707682248186045564102137590742467172304310498516787723642221858460240158712832";
$second = "23846232839228381";
$result = bcmod($first,$second);
echo $result;
// $result = 3433268;
Run Code Online (Sandbox Code Playgroud)
如果只有$ result和$ second值,如何计算$ first变量(如果我们不知道它)?
实际上不是确切的价值,但应该接近它,所以做的时候
bcmod($first, $second);
Run Code Online (Sandbox Code Playgroud)
它会将$ result值等于3433268
是,
bcmod('3433268',$second);
Run Code Online (Sandbox Code Playgroud)
还给出了3433268!
我感谢你的帮助,谢谢你们!
今天一个恼人的问题,我应该知道这一点,但对于我的生活,我无法弄明白.我在查询sql数据库之前尝试哈希密码.我的哈希码工作正常,但它在公共静态字符串中:
public static string GetCrypt(string text)
{
string hash = "";
SHA512 alg = SHA512.Create();
byte[] result = alg.ComputeHash(Encoding.UTF8.GetBytes(text));
hash = Encoding.UTF8.GetString(result);
return hash;
}
Run Code Online (Sandbox Code Playgroud)
我有两个问题,一个..一旦它被哈希,我如何获得该结果,因为当我尝试访问变量"哈希"时,它给出了当前上下文中不存在的错误.我怀疑这是由于公共和私人课程?
另外,我的另一个问题是,为了拥有一个更有效的程序,我或者已经是这样的代码,通过我输入一次,然后可以调用它来回传递变量.有点像,输入密码,哈希,然后传回来..然后在另一个文本框中将新变量传递给相同的哈希码并获得新的哈希变量?
先谢谢你们!
我试图转换包含普通字符和'_',';'和'='的sqlstring,当我尝试这样做时:
Byte[] byt = Convert.FromBase64String(value);
Run Code Online (Sandbox Code Playgroud)
我收到此错误消息
An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll
Additional information: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.
Run Code Online (Sandbox Code Playgroud)
Additonal: - 我用它来加密sqlstring -my解密,它使用同样的功能工作正常,但在尝试转换回加密时失败
我正在为我的学校项目编程,上面有一个问题。这是我的代码:
def aes():
#aes
os.system('cls')
print('1. Encrypt')
print('2. Decrypt')
c = input('Your choice:')
if int(c) == 1:
#cipher
os.system('cls')
print("Let's encrypt, alright")
print('Input a text to be encrypted')
text = input()
f = open('plaintext.txt', 'w')
f.write(text)
f.close()
BLOCK_SIZE = 32
PADDING = '{'
pad = lambda s: s + (BLOCK_SIZE - len(s) % BLOCK_SIZE) * PADDING
EncodeAES = lambda c, s: base64.b64encode(c.encrypt(pad(s)))
secret = os.urandom(BLOCK_SIZE)
f = open('aeskey.txt', 'w')
f.write(str(secret))
f.close()
f = open('plaintext.txt', 'r')
privateInfo = f.read()
f.close()
cipher …Run Code Online (Sandbox Code Playgroud) 我写了一个用于密码和密钥生成的散列函数,但很快意识到能够反转散列是非常有价值的,所以我写了一个相反的函数,但是,它起作用了.我不明白为什么这个DOESNT工作.
function hash64(n:uint):uint
{
n = (~n) + (n << 21);
n = n ^ (n >> 24);
n = (n + (n << 3)) + (n << 8);
n = n ^(n >> 14);
n = (n + (n << 2)) + (n << 4);
n = n ^ (n >> 28);
n = n + (n << 31);
return n;
}
function unhash64(n:uint):uint
{
n = (~n) - (n >> 21);
n = n ^ (n << 24); …Run Code Online (Sandbox Code Playgroud) hash actionscript cryptography bit-manipulation actionscript-3
我创建了哈希.比我在控制台上打印它.复制哈希值并将其放入代码进行比较.但它产生的不一样.
String input = "Hello";
String key = "Key";
Byte[] hashKey = Encoding.UTF8.GetBytes(key);
HMACSHA1 hmac = new HMACSHA1(hashKey);
Byte[] computedHash = hmac.ComputeHash(Encoding.UTF8.GetBytes(input));
String computedHashString = Encoding.UTF8.GetString(computedHash);
Console.WriteLine("Hash value of your input: .{0}.", computedHashString);
if ("?:????W?u$YLR;???T?j" == computedHashString)
{
Console.WriteLine("They are same!");
}
else
{
Console.WriteLine("They are NOT same!");
}
Console.ReadLine();
Run Code Online (Sandbox Code Playgroud)

先感谢您
cryptography ×10
encryption ×5
c# ×3
hash ×2
python ×2
actionscript ×1
algorithm ×1
android ×1
bytearray ×1
grails ×1
math ×1
passwords ×1
php ×1
pycrypto ×1
python-2.7 ×1
python-3.x ×1
security ×1
sql ×1
ssl ×1
string ×1
wireless ×1