Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 21st, 2004, 03:08 AM
Authorized User
 
Join Date: Feb 2004
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to knight
Default Encrypted Password field

Can i encrypt password field in access database such as
mysql password("abc") function how can it possible pls tell me



 
Old June 21st, 2004, 05:48 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Knight,

You can use some simple logic to do that on your own.

May be something like this.

Code:
<Script language="vbscript" runat="server">

    Dim i, Char
     Function Encrypt(pwdStr)
        For i = 1 To Len(pwdStr)
            Char = Asc(Mid(pwdStr, i, 1))
            Encrypt = Encrypt & Chr(((Char Xor 111) + 32) Mod 256)
        Next

    End Function

    Function Decrypt(pwdStr)
        For i = 1 To Len(pwdStr)
            Char = Asc(Mid(pwdStr, i, 1))
            Decrypt = Decrypt & Chr(((Char - 32 + 256) Mod 256) Xor 111)
        Next
    End Function

</Script>
Hope that helps.
Cheers!

_________________________
-Vijay G
Strive for Perfection
 
Old June 22nd, 2004, 02:04 AM
Authorized User
 
Join Date: Feb 2004
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to knight
Default

yea but Decrypt() is not working i mean the same output is shown both
cases

 
Old June 22nd, 2004, 06:20 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

No Knight, that cannot happen, as I am using this for a long long time. I think you are passing the same string for both. Only Ecrypted string can be Decrypted.

Just try this in the same page...

Code:
<%
response.write Encrypt("test") & "<BR>"
response.write Decrypt(Encrypt("test"))
%>
I get result printed as

;*<;
test


Cheers!

_________________________
-Vijay G
Strive for Perfection
 
Old June 22nd, 2004, 11:50 PM
Authorized User
 
Join Date: Feb 2004
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to knight
Default

yea dear u r right i use same string for both as i think that decrypt
function works the same string ok now it is good
thanks a lot


 
Old June 26th, 2004, 04:19 PM
Authorized User
 
Join Date: Jun 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi Happgv,
This is code is very interesting. I have got an error on line 8 when i made some changes and tries to run it.

Please help me,

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30491: Expression does not produce a value.

Source Error:



Line 6: sub page_Load(obj as object, e as eventargs)
Line 7:
Line 8: Response.write(Encrypt("test") & "<br>")
Line 9: Response.write(Decrypt(Encrypt("test")) & "<br>")
Line 10:

<%@ Page Language ="VB" %>

<Script runat="server">


sub page_Load(obj as object, e as eventargs)

    Response.write(Encrypt("test") & "<br>")
    Response.write(Decrypt(Encrypt("test")) & "<br>")

End sub

   sub Encrypt(pwdStr AS String)
         Dim i
         Dim Cha
         For i = 1 To Len(pwdStr)
           Cha = Asc(Mid(pwdStr, i, 1))
           Encrypt = Encrypt & Chr(((Cha Xor 111) + 32) Mod 256)
           Next
      End sub

   sub Decrypt(pwdStr As String)
        Dim i
        Dim Cha
        For i = 1 To Len(pwdStr)
           Cha = Asc(Mid(pwdStr, i, 1))
           Decrypt = Decrypt & Chr(((Cha - 32 + 256) Mod 256) Xor 111)
           Next
  End sub

</Script>
<html>
<body>
</body>
</html>








 
Old June 27th, 2004, 10:31 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi belete,

A SUB doesn't return value, but a FUNCTION does.;)

Change those SUBs to FUNCTIONs. See my previous post with the code.

Cheers!

_________________________
-Vijay G
Strive for Perfection
 
Old June 28th, 2004, 12:35 PM
Authorized User
 
Join Date: Jun 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Happygv,
I have fixed the problem
Thank you.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert Encrypted Password cancer10 Classic ASP Databases 0 April 10th, 2007 11:12 PM
Encrypted password harini19 Java Basics 0 February 15th, 2006 07:29 AM
Random+Encrypted Password ruhin Pro PHP 1 June 28th, 2004 02:07 PM
password in encrypted form mateenmohd SQL Server 2000 4 January 24th, 2004 07:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.