PDA

View Full Version : CRC Heaven



Bruce
06-09-2005, 11:41 PM
Trying to get the CRC value of a pic using this code (On Show Event) the cue.txt has the same crc # and the code compairs the two:

--Checks to see if the realtor pic is the right one.
crc_result = File.GetCRC("AutoPlay\\Realtor\\realtor.bmp");
cue_result = TextFile.ReadToString("AutoPlay\\Realtor\\cue.txt");
Input.SetText("Input1", crc_result);
Input.SetText("Input2", cue_result);
x = crc_result;
y = cue_result;
if (x ~= y) then
-- Do something here, they are not equal
result = Dialog.Message("Notice", "Contact Diginetx at 805-555-5555.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end

The two #s are the same but it says they’re not. What am I doing wrong?

Corey
06-09-2005, 11:57 PM
Here's an example project. If you change the image, it exits... :yes

Bruce
06-10-2005, 12:06 AM
Thanks Corey-
But I am trying to do this dynamically... Can you tell me what my code/I is doing wrong?

Corey
06-10-2005, 12:09 AM
But how can you verify it dynamically, you need an "anchor" value don't you? If the verification value is grabbed at runtime from a plain file then you are just as open to abuse as before, no? I must be misunderstanding what the task is. If the goal is to protect your images then you would not store the original CRC values in a text file, you would add them to your project. That way you can be sure your reference or "anchor" values are not tampered with. :yes

Bruce
06-10-2005, 12:17 AM
Good point. All I am attempting to do is make sure some terd head realtor does not switch out the information thats on the CD (all dynamic) for he's or her own.

I tryed some of your code here but it does the same thing:

crc = String.ToNumber(File.GetCRC("AutoPlay\\Realtor\\realtor.bmp"));
cue = TextFile.ReadToString("AutoPlay\\Realtor\\cue.txt");
x = crc;
y = cue;
if (x ~= y) then
-- Do something here, they are not equal
result = Dialog.Message("Notice", "Contact Diginetx at 805-555-5555.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end

Corey
06-10-2005, 12:29 AM
You are attempting to compare a number to a string, try this:

cue = String.ToNumber(TextFile.ReadToString("AutoPlay\\Realtor\\cue.txt"));

Instead of this:

cue = TextFile.ReadToString("AutoPlay\\Realtor\\cue.txt");

:yes

Bruce
06-10-2005, 12:34 AM
You are the man! Thanks once again! :yes :yes

Corey
06-10-2005, 12:49 AM
Always happy to help. :) :yes