www.webdeveloper.com
Results 1 to 3 of 3

Thread: crypt code modification...

  1. #1
    Join Date
    May 2006
    Posts
    33

    crypt code modification...

    Helloo..
    I am having some problems with modifying crypt code..

    I have file like this:

    file1:
    insert into serialxuniq values (null, '363456789', '119258147');
    insert into serialxuniq values (null, '993456789', '369258447');
    insert into serialxuniq values (null, '443456789', '369245147');
    insert into serialxuniq values (null, '123455489', '229258147');
    ....
    ...
    ..

    I would like to crypt only 3. value...

    I have code that crypt data and it works...any help..I have done so far..putting and retreiving data from mysql

    PHP Code:
    <?php
       
    /* Data */
      
        
       
    $key 'serialkey';
       
    $plain_text 'very important data';
      
       
    /* Open module, and create IV */
       
    $td mcrypt_module_open('des''''ecb''');
       
    $key substr($key0mcrypt_enc_get_key_size($td));
       
    $iv_size mcrypt_enc_get_iv_size($td);
       
    $iv mcrypt_create_iv($iv_sizeMCRYPT_RAND);

       
    /* Initialize encryption handle */
       
    if (mcrypt_generic_init($td$key$iv) != -1) {

           
    /* Encrypt data */
           
    $c_t mcrypt_generic($td$plain_text);
           
    mcrypt_generic_deinit($td);

    echo 
    "Plain text :";
    echo 
    $plain_text;  
    echo 
    "\n\r\n";

    echo 
    "Encrypt text:";
    echo 
    $c_t;  
    echo 
    "\n\r\n";

           
    /* Reinitialize buffers for decryption */
           
    mcrypt_generic_init($td$key$iv);
           
    $p_t mdecrypt_generic($td$c_t);




    echo 
    "Decrypt text:";
    echo 
    $p_t;   
    echo 
    "\r";

           
    /* Clean up */
           
    mcrypt_generic_deinit($td);
           
    mcrypt_module_close($td);
       }

       if (
    strncmp($p_t$plain_textstrlen($plain_text)) == 0) {
        
    //   echo "ok\n";
       
    } else {
           echo 
    "error\n";
       }
    ?>

  2. #2
    Join Date
    Aug 2004
    Location
    70 klicks above the Do Lung bridge
    Posts
    654
    Sorry dude, what's your actual problem with the code? ???

  3. #3
    Join Date
    May 2006
    Posts
    33
    well code works..but it codes only

    $plain_text = 'very important data'; variable in code...

    I want to code part of my txt file:

    startTXT file:
    insert into serialxuniq values (null, '363456789', '119258147');
    insert into serialxuniq values (null, '993456789', '369258447');
    insert into serialxuniq values (null, '443456789', '369245147');
    insert into serialxuniq values (null, '123455489', '229258147');
    ..
    ..

    targetTXT file:

    insert into serialxuniq values (null, '363456789', 'here encrypted data');
    insert into serialxuniq values (null, '993456789', 'here encrypted data');
    insert into serialxuniq values (null, '443456789', 'here encrypted data');
    insert into serialxuniq values (null, '123455489', 'here encrypted data');
    ..
    ...

    program I posted can encrypt data from 119258147 to J0gꓖ+

    etc...


    any ideas how to implement this??

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles