Need help to make this functions

Discussion in 'Programming' started by general666, Jul 24, 2010.

  1. #1
    Hello, i have problem, i have not skills to program this functions in PHP. Can somebody help me? I dont know if it's possible in PHP....

    This one is ok i have it:
    
    hashBytes = sha1(stringToSign);
    /* hashBytes = [0x54, 0xA9, 0xC5, 0xC1, 0xAB, 0x02, 0xE6, 0xC8, 0x85, 0x1B, 0xF5, 0x6A, 0x7E, 0x79, 0x9F, 0x18, 0xE6, 0x08, 0x63, 0xD0] */
    
    Code (markup):
    Here i have problems:
    
    hashBytes = hashBytes.slice(0, 8);
    /* THIS SHOULD SELECT FIRST 8 BYTES FROM hashBytes */
    /* hash = [0x54, 0xA9, 0xC5, 0xC1, 0xAB, 0x02, 0xE6, 0xC8] */
    
    key = "12345";
    keyBytes = stringToBytes(key); 
    /* RETURN ARRAY OF ASCII CODES CHARS OF KEY */
    /* keyBytes = [0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38]; */
    
    signatureBytes = des(keyBytes, hashBytes); 
    /* DES IN ECB MODE */
    /* signatureBytes = [0x4B, 0x9B, 0x9A, 0x14, 0x7A, 0x3E, 0x3A, 0xEF] */
    
    signature = bytesToHexaString(signatureBytes).toUpperCase(); 
    /* HAVE TO BE IN UPPERCASE*/
    /* signature = "4B9B9A147A3E3AEF" */
    
    Code (markup):
     
    general666, Jul 24, 2010 IP