#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    USA
    Posts
    194
    Rep Power
    16

    Need pointed in right direction Serial generation


    This is what I want to do in php.

    This is an example:

    --------- Keygenerator.php


    Use A Seed Key: 10952783587 <- any of my choosing
    Enter a Name: billy bob



    ---------

    result:

    Name: billy bob
    Key: 7319C0258CD6502BFFFEC44D


    In a decrypte.php

    enter 7319C0258CD6502BFFFEC44D

    to get the original name: billy bob


    can this be done?


    jobesd
    I only do what the voices in my head keep telling me to do.
  2. #2
  3. Doggie
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2003
    Location
    Seattle, WA
    Posts
    751
    Rep Power
    13
    How good does the encryption need to be? Here's a fast and dirty one, but not too hard to break if you know what to look for and you have at least one sample of a before and after value:

    for each letter in your key, do a binary xor against the corrasponding letter in your input value. If key runs out of characters, start again from the first character. Take end results, convert to Hex (since it can end up being any value)

    To reverse, convert hex to string, and xor against your key again.

    The only problem with this, is if someone knows both the start and end values, they can xor them against each other to get your key.

    I use this method for encrypting files on my HD (without the hex conversion) since no one could possibly know the before value. (even the file name is encrypted)
    Last edited by dog135; July 15th, 2003 at 08:18 PM.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    USA
    Posts
    194
    Rep Power
    16
    I think that I can do it this way. I am using base64 encoding with a variety of encoding,slicing and dicing, rencoding and an eregi at the end.

    seed key "0123456789";
    name = "My Name";

    cryptkey1 = "1268469bGr4576KfRGVD22307"
    cryptkey2 = "5lu7s3fg5ll8591311lygfd"
    cryptkey3 = "kl582fg69hjlddWNgf458FF12886"


    after doing what I do I get this serial. to decrypt I just do a reverse order of the steps.


    serial =

    Vm14a01HRXhUWGxVYms1aFUwWmFVMWxyYUVOalJsbDNWbXQwV0ZadFVsaFhWRTV2VlRBeFZrNVZhRnBOUmxwMlZsVmFZV05zVG5O aA0KUmxwb1lUTkNNbFpHVm1GWGJWWllWV3RLVVEwS1ZrUkNUMUV5ZEVkTlJsSjBWRzB4VGxKRmEzaFVNRkpPVGxFd1MxUnJVa1ps UlRSMw0KVFZaV1ZGZElRbEJWYTFwV1pWWlNkV05ITlU5V1ZFWkdWV3hvYzFSdFZuTlNXR2hWWWxoQ2NRMEtWR3RWTlZaV1JsVk5S VFZFV25vdw0KT1VSUmNIaFpiVFF4V1RKb2JtRkVhelJhYlZGNVRXcFdWbUV5VWt4Wk1uaHJaRlpHYzJOSGJGaFNWWEJhVmpGYWFt VkdTWGhVYTJScQ0KVWxkb1VRMEtWbTEwUzFkR1ZuRlRiVGxPVW14c05WcEZSVGxRVVRCTFVWaFNUMWt5V1hkTmFsVTBUWHByTUUx VVJUTlVWbEpLWldzMQ0KUlZaVVNrOWxiV014VkZWU1JtVlZNVFpWVkVaUFlXMU5NQTBLVkRGU1FsQlJNRXNOQ2c9PQ0K
    decrypted = My Name



    I just don't know how secure it would be using this method. I don't have mcrypt available.

    If I wanted to xor two serials like above together how could I do that?

    I figure if I can make the scheme screewy and enough steps I can really make it difficult.


    jobesd
    Last edited by jobesd; July 15th, 2003 at 10:52 PM.
    I only do what the voices in my head keep telling me to do.
  6. #4
  7. Doggie
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2003
    Location
    Seattle, WA
    Posts
    751
    Rep Power
    13
    I don't know about PHP, but to xor two values in Perl or C, you just do:

    newval=oldval[x]^key[x];

    The "^" character is the binary xor operator.

IMN logo majestic logo threadwatch logo seochat tools logo