Solved

How to produce a SHA-1 hash function in vb6 in order to save it to a table

Posted on 2016-11-09
8
63 Views
Last Modified: 2016-11-09
Please help us for a code in vb6 to hash SHA-1 a string before I saving to a table.

Thank you in advance
0
Comment
Question by:rayluvs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 22

Expert Comment

by:JesterToo
ID: 41881496
Perhaps you meant "encrypt" instead of "hash" since hashes are one-way and I'd assume you want to decrypt it sometime.  If so, then here is a link that describes hot to accomplish that.

https://support.microsoft.com/en-us/kb/821762
0
 

Author Comment

by:rayluvs
ID: 41881514
Yes, that's what we need, one-way.  We hash sha1 the result save it to table.

Can this be done in vb6?
0
 
LVL 22

Expert Comment

by:JesterToo
ID: 41881517
Ok, take a look at this link.  It has source code that purports to do what you want.

http://vb.wikia.com/wiki/SHA-1.bas
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 22

Accepted Solution

by:
JesterToo earned 500 total points
ID: 41881525
in the event that code proves to be faulty, search the internet for this phrase...

"vb6 sha1 source code philip ciebiera"
0
 

Author Comment

by:rayluvs
ID: 41881571
Thanx!!! Found a code thet works excellent and we compared it to MS SQL HASHBYTE function is almost the exact!

We say exact because the SQL function always returns "0x" when the vb code doesn't.

For example the has for 'experts-exchange' in

vb6 code is:             9022fc0e1985bb7c0ac60792ee3fbe3029af0424

in SQL is:                 0x9022FC0E1985BB7C0AC60792EE3FBE3029AF0424

                                 notice "0x"

We extract the "0x" from SQL statement result and both SQL & VB results are the same.

Is there a reason for the "0x" and should we be concerned?
0
 
LVL 22

Expert Comment

by:JesterToo
ID: 41881581
yes, that is not actually a part of the hash.  It is there to signify that the remaining characters are hexidecimal. It is safe to just strip it off as you did.
0
 

Author Comment

by:rayluvs
ID: 41881582
Thanx!!! You really helped us!!
0
 
LVL 22

Expert Comment

by:JesterToo
ID: 41881588
You're welcome.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question