when i use sha 512 on password field then it says k pasword field cannot be empty but when i remove sha512 constraint then it works and with any other hash it also works why ?
and plz suggest me some good secrity hash etc to apply on password field

Recommended Answers

All 7 Replies

Cannot insert the value NULL into column 'password',

this error :( when i used HASHBYTES('sha512',@password )

Can you show your full query?

@fullname varchar(50),
    @email varchar(50),
    @password varchar(40),
    @question varchar(80),
    @answers varchar(100),
    @roleid int = 3

AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure here
    insert into tblUser(fullname, email, password, question, answers,doc,roleid)
    values (@fullname,@email,HASHBYTES('sha1',@password),@question, @answers, GETDATE(),@roleid )
END
insert into tblUser(fullname, email, password, question, answers,doc,roleid)
    values (@fullname,@email,HASHBYTES('sha512',@password),@question, @answers, GETDATE(),@roleid )

    **Now when i execute EXEC statement like this :

exec dbo.appReg_sp "tom",'dd@hotmail.com','diedie','Your nick name ?','tommy'

**
then it gives the above error: Cannot insert the value NULL into column 'password',

but works for sha1 .why ?????

Oh, just found that sha512 is supported as of MS SQL Server 2012...

ohhhh my GOD :(
isn't there any alternaticve ?
or what if i use it from asp.net ,by creatinf class of it ?

Well sure, if you encrypt it in code (SHA512Managed class), then you can just store it.

and it worked and what about sha1 , is it secure mean hard to break ? using it is suggested ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.