LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Encryption Routine for Passcodes

I previously posted "Hard Drive and NIC Serial #/ID". Now that I am able to
read the hard drive serial number and convert it to a 32 bit integer I was
wondering what a good encryption routine would be to perform on this number
to create a passcode. I've come up with various bit shifting routines that
may work OK but I'm sure there are much better routines out there that would
be harder to crack. Can anyone recommend one?


0 Kudos
Message 1 of 16
(4,707 Views)
nealpederson;

You can hash the value. You can download the MD5 hashing VI from my website.

A lot better will be to create a Data Authentication Code (DAC). Check out Crypto-G

Regards;
Enrique
www.vartortech.com
Message 2 of 16
(4,703 Views)
I downloaded the MD5 library and have two questions:

1. I assume to make the hash unique for other programs I would simply modify
the "Chaining Variables" (A, B, C, and D in "MD5 Message Digest.vi"). Is
this correct?

2. If I know the chaining variables how do I un-hash the MD5 message to
check it against the volume ID?


0 Kudos
Message 3 of 16
(4,684 Views)
1. No. To make the ID unique for other programs you need to give your programs a different ID. If you change the ABCD values, then the hashing function 1) will works only for you (i.e. nobody else with their own MD5 function will be able to corroborate the hash unless they also know your ABCD values. MD5 is a commercial standard) and 2) may not be guarantee to work "as advertised".

2. No. This is against the nature of a hash function. Once you hash it, you can not recover the original. If you need to obtain the original value, then you are asking how you can encrypt that original value.

What is your final intention? If you prefer, e-mail me directly and I will be more than happy to assist you.
www.vartortech.com
Message 4 of 16
(4,681 Views)
Hello,

Is there any simple article that explains the basics of the MD5? I know what hashing is from my old university studies but I haven't followed what happened in the 20 years since then.

What would be the technology to use to send commands through a network that an "intruder" could eventually catch and shouldn't be able to repeat later? I assume none of the MD5 or CRC Vis that I've seen here can help in this case, right?

Thanks,

Marce
0 Kudos
Message 5 of 16
(4,673 Views)
Marce;

There are two methods. I am not claiming these are the only ones:

Assymetric encryption (also known as public key encryption) is the most commonly used these days. You have two keys that are mathematically related: one is called the private key and the other the public. The private is secret and only known to you. You share the public one (i.e., is public) You can "sign" data with your private key and everybody can verify your signature with the public key. Anybody can encrypt something with the public key, and you are the only one that can decrypt it.

The other method is message authentication codes (MAC). Only you and "the other end" know the secret. You can sign the data using the secret, and the other end can verify it.

Both techniques requires hashing (strictly speaking, not with assymetric encryption, but then performance is an issue.)

Regards;
Enrique
www.vartortech.com
Message 6 of 16
(4,660 Views)
Enrique,

I think I just answered my own question (step 4 below). Here is the routine
I plan:

1. The first time the program starts it will prompt the user to call me and
provide their HD serial number or I could use their NIC ID or something
unique to their computer. The NIC ID might be safer since I don't believe
they can change this. The only problem is that they might not have a NIC or
they may change the NIC more frequently than the HD.

2. I will run a separate program that only exists on my computer that would
hash the variables with unique ABCD values and then provide the number
created to my customer.

3. They will enter this number and my program will save it to a file so they
don't have to enter it again.

4. Whenever their program starts it will read the unique ID from their
computer and run the hash code. It then compares the hash code to the saved
hash code for verification. Previously I was thinking that I needed to
"unhash" the code before comparison but I now I see this isn't necessary.

Thanks for your help!

"Enrique" <x@no.email> wrote in message news:207320@exchange.ni.com...
> 1. No. To make the ID unique for other programs you need to give your
> programs a different ID. If you change the ABCD values, then the hashing
> function 1) will works only for you (i.e. nobody else with their own MD5
> function will be able to corroborate the hash unless they also know your
> ABCD values. MD5 is a commercial standard) and 2) may not be guarantee to
> work "as advertised".<br><br>2. No. This is against the nature of a hash
> function. Once you hash it, you can not recover the original. If you need
> to obtain the original value, then you are asking how you can encrypt that
> original value.<br><br>What is your final intention? If you prefer, e-mail
> me directly and I will be more than happy to assist you.


0 Kudos
Message 7 of 16
(4,646 Views)
nealpederson;

I am glad you got a solution that fit your needs.

For what I understand, in order for the customer's computer to regenerate the right hash for verification, it needs to have that same "separate program that only exists on my (your) computer" too. Also, they must have the unique ABCD values too. That's ok for certain scenarios. Make sure you password protect that VI (and save the password in a safe place).

If you want, I am available to take a look at it as soon as you have it.

Regards;
Enrique
www.vartortech.com
Message 8 of 16
(4,633 Views)


@nealpederson wrote:
Enrique,

I think I just answered my own question (step 4 below). Here is the routine
I plan:

1. The first time the program starts it will prompt the user to call me and
provide their HD serial number or I could use their NIC ID or something
unique to their computer. The NIC ID might be safer since I don't believe
they can change this. The only problem is that they might not have a NIC or
they may change the NIC more frequently than the HD.
Most network cards allow the MAC address, which I assume you mean by NIC address, to be changed with a utility.
2. I will run a separate program that only exists on my computer that would
hash the variables with unique ABCD values and then provide the number
created to my customer.

3. They will enter this number and my program will save it to a file so they
don't have to enter it again.

4. Whenever their program starts it will read the unique ID from their
computer and run the hash code. It then compares the hash code to the saved
hash code for verification. Previously I was thinking that I needed to
"unhash" the code before comparison but I now I see this isn't necessary.

Enrique already sort of answered this. If you use a hash such as MD5 or SHA the function to compute the hash will be necessary both at your computer as well as in your application which runs at the customer site. This is because of the nature of a hash.

What you describe above is rather something where you use a public and private keypair encryption. Your license generator gets the customer provided ID(s) and creates with the private key a license number. In your software application you decrypt the license number with the public key and compare the result with the IDs you queried again. If they don't much the license key is not valid or the system IDs you used to create the license key have changed.
So be careful as a customer can get very annoyed if his application refuses to run because he had to replace the HD after a disk crash. Or imagine a computer such as my notebook with a wireless network adapter and a wired network interface. At home the wireless interface is active and querying the MAC address will give this ID and in the office the wired connection is active and querying the MAC address of the active network card will return a different MAC address. If an application would refuse to run in either place for me because of a stupid license check that application would be harshly banned with total ignorance by me and I would make sure as much other people as possible know that its license check is crap and it is a bad idea to buy it.

Rolf Kalbermatter
Rolf Kalbermatter
My Blog
0 Kudos
Message 9 of 16
(4,397 Views)

Hey Neal,

Were you able to finally get the hard disk number. I am trying to do a similar thing but unable to get the data.

Can you please post an example how you achieved the Encryption working for you.

 

 

Thanks and Regards

CLAD
Using Labview 5.1,6.1,7.1.8.0
0 Kudos
Message 10 of 16
(4,030 Views)