Welcome, Guest! Login | Register

Using ICE Encryption in Your Mod [Print this Article]
Posted by: ts2do
Date posted: Jun 15 2005
User Rating: 1 out of 5.0
Number of views: 5920
Number of comments: 19
Description: Directions on how to encrypt your weapon scripts and and any other file
user posted image
ICE is the type of encryption Valve uses for scripts like the weapon scripts...Weapon script files are encrypted into a file of the extension .ctx
If you do not know the encryption key of your mod, it's probably x9Ke0BY7 (the default for HL2DM)

  • Why do I want to encrypt my script files?

    You should encrypt your script files so they can not easily be changed by users.
    To have the ability to change the weapon scripts, a mod user would have to delete the .ctx files and create the .txt files from scratch.
    This makes your mod more resistant to change, which means hosted servers won't as likely have changed the weapon scripts.

  • How do I deal with encryption for my mod?


    • Encrpyting script files
      Download this file and install it into your Source SDK bin folder (C:\Program Files\[Valve]\Steam\SteamApps\[Username]\sourcesdk\bin):
      Zip FileFilename: vice.zip
      File Size: 43.8 KB


      Execute this in the command prompt to make the .ctx files:
      "[Source SDK Bin]\vice.exe" -encrypt [Key: x9Ke0BY7 by default] -newext .ctx [.txt filenames (Use * for wildcard)]


    • Changing the encryption key for your mod
      To change the encryption key for your mod, you must change the returned string in the function "GetEncryptionKey" in the gamerules. The new encryption key must be eight characters long. This encryption key should be used when running vice.


    • Decrypting script files
      If you happen to lose your .txt files and you only have their .ctx files and your mod's encryption key, you can run vice to decrypt also:
      "[Source SDK Bin]\vice.exe" -decrypt [Key: x9Ke0BY7 by default] -newext .txt [.ctx filenames (Use * for wildcard)]



    Here's some defines to make your life somewhat easier if you wanna look for ctx and txt or just any specific type...
     CODE (C++) 
    #define findFiles( path, todo ) findExtFiles( path, todo, .txt );\
                            findExtFiles( path, todo, .ctx )
    #define findExtFiles( path, todo, ext ) {\
            FileFindHandle_t findHandle;\
            const char *pFilename = filesystem->FindFirstEx( "##path##*##ext##", "MOD", &findHandle );\
            while ( pFilename != NULL )\
            {\
                todo;\
            }\
            filesystem->FindClose( findHandle );\
        }(void)0


    then you just say
     CODE (C++) 
        findFiles(
            scripts/weapons/,

            char fileBase[512];
            Q_FileBase( pFilename, fileBase, sizeof(fileBase) );
            WEAPON_FILE_INFO_HANDLE tmp;
            if ( ReadWeaponDataFromFileForSlot( filesystem, fileBase, &tmp, pICEKey ) )
                gWR.LoadWeaponSprites( tmp );
            pFilename = filesystem->FindNext( findHandle );
        );

    but never do quotes around extensions or paths

  • Rate This Article
    This article is currently rated: 1 out of 5.0 (1 Votes)

    You have to register to rate this article.
    Related Files
    Zip FileFilename: vice.zip
    File Size: 43.8 KB

    User Comments Showing comments 1-19

    Posted By: Counter Life on May 30 2005 at 00:50:30
    did some digging in the Counter-Strike Source client.dll
    and found the encryption key.. d7NSuLq2

    i was finaly able to decrypt them damn weapon script files :)

    oh yeah and nice article !

    edit:
    Someone emailed me saying this key for CSS doesn't work now.
    It should.
    i have the newest CSS Client.dll and just checked..
    and its still, d7NSuLq2Edited by Counter Life on Oct 19 2005, 02:23:59

    Posted By: ts2do on May 30 2005 at 02:06:53
    I see that it's near the start of CSGameRules in wordpad....
    what doesnt make sense is why they have it defined as a gamerules function.....because if there are going to be multiple gamerules, they're gonna be using the same encryption key....of course if someone would want to disable a weapon in certain gamerules, they could do it this way with 100% control, (unless someone figured out the key and decrypted em all that is)Edited by ts2do on May 30 2005, 02:14:31

    Posted By: soulescape on Sep 30 2005 at 11:02:32
    What's the encryption key for DoD source?

    Posted By: naaier on Oct 18 2005 at 06:20:38
    I'm have trouble with this, vice shows "input file" then says "cant open file" what am I doing wrong????

    Posted By: KillerKind on Nov 14 2005 at 19:24:52
    Anyone know DoD: Source's encryption key?

    Never mind, I found it. ;)Edited by KillerKind on Nov 18 2005, 21:02:19

    Posted By: Unknown on Dec 21 2005 at 16:40:47
    anyone know dods encyption key?

    Posted By: Konstantin on Jan 21 2006 at 00:38:57
    Wl0u5b3f

    Pretty easy to find, actually.

    Posted By: AbsolutE on Jan 28 2006 at 07:56:58
    Alright, this is a really nub question, but how to you view the client.dll in wordpad?

    Posted By: blackcloud161 on Feb 02 2006 at 19:10:52
    I am getting an error when I execute the vice program "Extra App ID set to 211, but no SteamAppId." What am I doing wrong??? Thanks for the input.

    Posted By: blackcloud161 on Feb 02 2006 at 19:13:22
    Hey Absolute !! to answer your question... just right click on the client.dll file and chose open with and then select the program word pad. ( there may be one other step in between but can not recall at this time but I do remeber just select the bottom radio button) hope this helps....

    Posted By: ts2do on Feb 02 2006 at 21:26:16
    check out http://developer.valvesoftware.com/wiki/Vice for the new binary...steam independent

    Posted By: blackcloud161 on Feb 03 2006 at 10:47:40
    Thanks ts2do !!! just one last thing. I have the file decrypted and modified for our Lan server. But there appears to be no way to re-encrypt with the new independent program. The help menue says nothing about encrypting. is the extention -e for encrypt?? The steam dependant one also does not work as would be expected. It appears that re-encryption is nessary for the game to work. Or does each computer need to have the decrypted CTX file ??? I will test that later today. Again Thanks for all your help.

    Posted By: ts2do on Feb 03 2006 at 19:42:04
    just leave -d out to encrypt...

    Posted By: Unknown on Feb 07 2006 at 18:47:29
    Sup yall
    I am having a problem where i have the steam independed but it always fails to find the blasted file. anyu suggestions

    p.s. i am typing in as follows
    ice -d -x .txt -k d:\program files\steam\models\weapon_ak47.ctx
    "The system can not find the specified file"

    i made the modle folder was a naming mishap
    also the ice binary is in the model folderEdited by Unknown on Feb 07 2006, 18:50:43

    Posted By: ts2do on Feb 07 2006 at 20:36:42
    you didn't provide the key

    Posted By: Unknown on Feb 08 2006 at 06:01:04
    Yes i did. Something apprently is when i put it in the msg board is knocks is off

    ice -d -x .txt -k "" d:\program files\steam\models\weapon_ak47.ctx
    "The system can not find the specified file"

    I had to add the " " to make it work, it barks at me if i do not enter the key in "< key >" that format w/o the " " obviously.Edited by Unknown on Feb 08 2006, 06:01:42

    Posted By: ts2do on Feb 08 2006 at 15:13:26
    the key is 8 characters long
    and the name of the file is vice...not ice
    Also call it from its folder...unless you placed it in your system folder

    Posted By: Unknown on Feb 08 2006 at 18:30:43
    OHHH K
    see that is where i was going wrong you useage of the word vice just unlock the whole friggen THING!!!! Ya know i am pretty dense, but when it comes to computer i am not. This time i just failed miserably ohhh soo miserably ohh well thanks for the help

    Posted By: {UPS}DoloMight[FRD] on Mar 14 2006 at 04:35:18
    Hi i just downloaded this tool, vice. When click on this aplication i get a small dos prompt that says a few things and press any key to continue. now when i got to press any key to try and type this stuff in. The window just closes on me. I dunno what you guys are doin. Please help.Edited by {UPS}DoloMight[FRD] on Mar 14 2006, 04:35:54


    You must register to post a comment. If you have already registered, you must login.

    Latest Articles
    3rd person View in Multiplayer
    Half-Life 2 | Coding | Client Side Tutorials
    How to enable it in HL2DM

    By: cct | Nov 13 2006

    Making a Camera
    Half-Life 2 | Level Design
    This camera is good for when you join a map, it gives you a view of the map before you join a team

    By: slackiller | Mar 04 2006

    Making a camera , Part 2
    Half-Life 2 | Level Design
    these cameras are working monitors that turn on when a button is pushed.

    By: slackiller | Mar 04 2006

    Storing weapons on ladder
    Half-Life 2 | Coding | Snippets
    like Raven Sheild or BF2

    By: British_Bomber | Dec 24 2005

    Implementation of a string lookup table
    Half-Life 2 | Coding | Snippets
    A string lookup table is a set of functions that is used to convert strings to pre-defined values

    By: deathz0rz | Nov 13 2005


    Latest Comments
    Where do we go from here
    General | News
    By: MIFUNE | Jun 09 2008
     
    The Input/Output system
    Half-Life 2 | Level Design
    By: nazitaco | Dec 23 2007
     
    Where do we go from here
    General | News
    By: Rob_F | Nov 22 2007
     
    Rescaling Half-Life
    Half-Life | Coding | Shared Tutorials
    By: christoph | Nov 12 2007
     
    GameUI
    Half-Life 2 | Coding | Client Side Tutorials
    By: Evil_j | Oct 29 2007
     
    3 State Zoom For Any Weapon
    Half-Life 2 | Coding | Server Side Tutorials
    By: Ennuified | Oct 18 2007
     
    Storing weapons on ladder
    Half-Life 2 | Coding | Snippets
    By: cct | Sep 07 2007
     
    CTF Gameplay Part 1
    Half-Life | Coding | Shared Tutorials
    By: DarkNight | Aug 28 2007
     
    CTF Gameplay Part 1
    Half-Life | Coding | Shared Tutorials
    By: deedok | Aug 20 2007
     
    Debugging your half-life 2 mod
    Half-Life 2 | Coding | Articles
    By: blackshark | Aug 17 2007
     

    Site Info
    296 Approved Articless
    5 Pending Articles
    3940 Registered Members
    0 People Online (13 guests)
    About - Credits - Contact Us

    Wavelength version: 3.0.0.9
    Valid XHTML 1.0! Valid CSS!