Tiré de Director Online

Serial Number protection of projectors

Posted by: arcticflea (—.rdg.ac.uk)
Date: January 29, 2007 03:27PM

Hi all

I'm trying to produce a system where we lock a projector's usage down to an individual. I'm intending to use the individual's email address, combined with their hard disk serial number and encoded to produce a serial number which can be quickly checked at run time. The serial number would be generated at our end (possibly) and emailed to the user.

Has anyone got any hints on how to do this easily, before I get bogged down in trying to create my own algorithms and such?

I would be happy to use a 3rd party extra…

Thanks

Flea

Re: Serial Number protection of projectors

Posted by: Chunick (—.static.tbaytel.net)
Date: January 30, 2007 05:20AM

Step #1: get unique pieces of information from the customer. This can include email address, first & last name, business name, hard disk serial number (although there are inherent problems with using a HD serial number, just ask microsoft). If you are using this below scheme with many different products then give your products unique codes and add that code into the string, ie. My Personal Journal Software version 1.5 might have the unique product code MYPJS01.

Step #2: Given any length of data in the form of a string we need to manipulate it in such a way as to always get an expected length of characters back. ie. put in x length of characters in the form of a string and get back a registration number that's 16 characters long.

Step #3: Need to customize it in such a ways as to make it unique. This can be accomplished thru encryption methods.

Step #4: Need to be able to verify the registration key is valid.

Here's a basic method you can use to do this:

-- moviescript 

-- Dependencies: 
-- 1) Calu's MD5 checksum Xtra which can be found (for free) here: 
-- [xtras.calu.us] 
-- 2) hexToDec() function created using javascript 

on generateKey(inputStr) 
  
  -- here is where you can encrypt the inputStr. Use an encryption algorithm 
  -- or build your own custom one. Many can be found at mediamacros.com. 
  -- inputStr = EncryptStr(inputStr) 
  
  regKey = "" 
  -- this line is important as the number of characters to draw from it is 
  -- exactly 32... and our MD5 returns a 32 character string. This is no 
  -- coincidence... you will also notice that I, O, S and Z are removed from 
  -- the list since they can be mistaken for numbers 1, 0, 5 and 2... which 
  -- brings the character count to 32. 
  validChars = "0123456789ABCDEFGHJKLMNPQRTUVWXY" 
  md5 = xtra("caluMD5").new() 
  caluMD5_register("I","agree with the usage terms") 
  hash = md5.getStringMD5(inputStr) 
  -- take sets of two characters and convert from hex to decimal and mod 32 
  -- to get a character from the validChars string. 
  repeat with i = 1 to 16 
    kChar = hexToDec(hash.char[i*2-1..i*2]) mod 32 + 1 
    regKey = regKey & validChars.char[kChar] 
    if (i mod 4) = 0 and i < 16 then regKey = regKey & "-" 
  end repeat 
  return regKey 
end 

on validKey(inputStr, regKey) 
  testKey = generateKey(inputStr) 
  return (testKey = regKey) 
end 
// javascript functions - place in another moviescript, works in MX2004 only 
// if using version lower than MX2004 then search mediamacros.com for Lingo 
// script that can accomplish the same thing. 
 
function hexToDec(hex) { 
return(parseInt(hex, 16 )); 
} 

there are several ways to customize the registration scheme: 1) encrypt the string with a known or custom encryption method. This can be done as suggested in the comments above. 2) use another hash algorithm such as SHA1, MD4, RIPEMD, etc… there are plenty of implementations on the internet in Javascript. 3) change the characters around in the validChars string.

** Remember that you might want to set names to uppercase or lowercase due to variances in spelling habits which can cause annoying errors in what should be an otherwise straightforward security scheme for the customer.

// additional useful javascript functions 
 
function UCASE(str) { 
return str.toUpperCase(); 
} 
 
function LCASE(str) { 
return str.toLowerCase(); 
} 

The scheme listed above can easily work in a web based application using PHP or ASP variants of the functions so you could easily integrate this solution in an online shopping cart system where the registration key is generated after the customer pays for the product and has already provided the information needed to generate the registration number.

This is a simplified scheme that I have implemented in the software products the company I work for sells.

director/snippets/serial_number_protection.txt · Dernière modification: 2007/06/26 15:01 (modification externe)
 
Sauf mention contraire, le contenu de ce wiki est placé sous la licence suivante : CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki