我正在創建一個保存用戶註冊的表單。我想將密碼作爲散列或md5插入數據庫。如何在coldfusion中將密碼作爲散列插入Ms SQL?
這是我的HTML表單很少的ColdFusion代碼:
<form id="myForm" class="ui form segment" method="post" action="registeraction.cfm">
<p>Let's go ahead and get you signed up.</p>
<div class="field">
<div class="field">
<label>Name</label>
<input placeholder="Name" name="name" type="text">
</div>
</div>
<div class="field">
<div class="field">
<label>Email</label>
<input placeholder="Email" name="email" type="email">
</div>
</div>
<div class="field">
<div class="field">
<label>Password</label>
<input placeholder="Password" name="password" type="password">
</div>
</div>
<input class="ui blue submit button" type="Submit" value="Submit">
</form>
這是registeraction.cfm代碼:
<!--- Insert the new record --->
<cfinsert datasource="mydatasource" tablename="Users">
<h1>User Added</h1>
<cfoutput> You have added #Form.name# #Form.email# to the testdb database.
</cfoutput>
正如下面@pete freitag所示 - 請重新考慮更好的散列算法。爲此,我在SQL Server中使用'bcrypt'作爲CLR。 –