我一直在使用PHP crypt()
作为在我的数据库中存储和验证密码的方法.我对其他东西使用散列,但是crypt()
对于密码.文档不是很好,似乎有很多争论.我正在使用河豚和两种盐来加密密码并将其存储在数据库中.在我存储salt和加密密码之前(如盐腌哈希)但实现了它的冗余,因为salt是加密密码字符串的一部分.
我对彩虹表攻击如何工作有点困惑crypt()
,无论如何从安全的角度来看这看起来是正确的.我使用第二个盐来附加密码以增加短密码的熵,可能是矫枉过正,但为什么不呢?
function crypt_password($password) {
if ($password) {
//find the longest valid salt allowed by server
$max_salt = CRYPT_SALT_LENGTH;
//blowfish hashing with a salt as follows: "$2a$", a two digit cost parameter, "$", and 22 base 64
$blowfish = '$2a$10$';
//get the longest salt, could set to 22 crypt ignores extra data
$salt = get_salt ( $max_salt );
//get a second salt to strengthen password
$salt2 = get_salt ( 30 ); //set to whatever …
Run Code Online (Sandbox Code Playgroud) 我在C#项目中有一个HTTPSystemDefinitions.cs文件,它基本上描述了托管代码消耗的旧Windows ISAPI.
这包括与ISAPI相关的完整结构集,不是全部或代码消耗的结构.在编译时,这些结构的所有字段成员都会发出如下警告: -
警告字段'UnionSquare.ISAPI.HTTP_FILTER_PREPROC_HEADERS.SetHeader'永远不会分配给,并且始终具有其默认值null
要么
警告从不使用字段'UnionSquare.ISAPI.HTTP_FILTER_PREPROC_HEADERS.HttpStatus'
可以禁用这些#pragma warning disable
吗?如果是这样,相应的错误号是什么?如果没有,我还能做什么?请记住,我只对这个文件做了什么,重要的是我看到来自其他文件的警告.
编辑
结构示例: -
struct HTTP_FILTER_PREPROC_HEADERS
{
//
// For SF_NOTIFY_PREPROC_HEADERS, retrieves the specified header value.
// Header names should include the trailing ':'. The special values
// 'method', 'url' and 'version' can be used to retrieve the individual
// portions of the request line
//
internal GetHeaderDelegate GetHeader;
internal SetHeaderDelegate SetHeader;
internal AddHeaderDelegate AddHeader;
UInt32 HttpStatus; // New in 4.0, status for SEND_RESPONSE
UInt32 dwReserved; // New in …
Run Code Online (Sandbox Code Playgroud) 我已经定义了一个记录,其中包含许多不同类型的字段(整数,实数,字符串,...以及"数组..."的动态数组).我想将它作为一个整体保存到文件中,然后能够将其加载回我的程序.我不想单独保存每个字段的值.文件类型(二进制或ascii或...)并不重要,因为Delphi可以将其读回记录.
你有什么建议吗?
为什么IPv4的十进制值与inet_pton和inet_addr(1734763876)不同,如果您使用这两个网站(1684366951)?
struct sockaddr_in sin;
inet_pton(AF_INET, "100.101.102.103", &(sin.sin_addr));
printf("%i\n%i\n", inet_addr("100.101.102.103"), sin.sin_addr);
Run Code Online (Sandbox Code Playgroud)
在尝试使用时运行所有内容时,从另一个批处理文件调用批处理文件时出现问题Process.Start
.基本上我调用从我的c#程序执行批处理文件,如下所示:
call include.bat
//execute the rest of the batch file here
Run Code Online (Sandbox Code Playgroud)
include.bat文件设置路径,可以由许多其他批处理文件使用.当我运行时,Process.Start
有时这是有效的,有时我得到ERROR: cannot find include.bat
.首先,任何想法为什么会发生这种情况?关于如何从批处理文件中解决这个问题的想法?
var quantSubset =
from userAns in userAnalysis.AllUserAnswers
join ques in userAnalysis.AllSeenQuestions on userAns.QID equals ques.QID
where (ques.QuestionType == "QT")
select new {
QuestionLevel = ques.LevelID,
TimeTaken = userAns.TimeTaken,
Points = userAns.Points,
UsedWeapon = (userAns.UsedBy2 && userAns.UsedHint),
WasCorrect = userAns.WasCorrect.HasValue ? userAns.WasCorrect.Value : null
};
Run Code Online (Sandbox Code Playgroud)
在我的select表达式中,我想选择一个可以为空的类型WasCorrect(表达式的最后一部分),但显然我不能按照我目前的方式去做.
如何将WasCorrect作为可空类型
我试过?WasCorrect但是在Visual Studio中也没有给出错误.
我正在继承一个类,我想调用它的一个构造函数.但是,在调用它之前,我必须处理一些东西(不需要基类的任何东西).有什么办法我可以稍后调用它而不是在初始化列表中调用它吗?我相信这可以用Java和C#完成,但我不确定C++.
我需要在构造函数上传递的数据以后不能重新分配,所以我不能只调用默认构造函数并在以后初始化它.
我有rails源代码的最新克隆.
我想借助rails latest commit创建应用程序.我不会在生产中使用这些应用程序.只是为了实验.
我该怎么做 ?
我有这段C代码:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct Date {
int date;
char* month;
int year;
} Date_t;
typedef Date_t* pDate_t;
void assignMonth(pDate_t birth)
{
//1)
birth->month = "Nov";
//2)
//birth->month = malloc(sizeof(char) * 4);
//birth->month = strcpy(birth->month, "Nov");
}
int main()
{
Date_t birth;
birth.date = 13;
assignMonth(&birth);
birth.year = 1969;
printf("%d %s %d\n",birth.date, birth.month, birth.year);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
在函数中,assignMonth
我有两种分配月份的可能性.两者都在输出中给出了相同的结果,那么它们之间的区别是什么?我认为第二种变体是好的,我错了吗?如果是,为什么?如果没有,为什么?
在此先感谢您的帮助.
PS我对两种情况下记忆中发生的事情感兴趣.
c# ×3
c ×2
batch-file ×1
c++ ×1
constructor ×1
delphi ×1
delphi-2010 ×1
encryption ×1
file-io ×1
fork ×1
git ×1
hash ×1
linq ×1
nullable ×1
php ×1
posix ×1
salt ×1
security ×1