Jump to content

Recommended Posts

Posted

Since I wasn't able to find it anywhere on the net I decided to make it myself.

For whoever needs it in the future :)

 

   private static byte[] Encrypt(string password)
   {
    var key = new byte[16];
       long one, two, three, four;
       var dst = new byte[16];
       var nBytes = password.Length;

       for (var i = 0; i < nBytes; i++ )
       {
           key[i] = Encoding.ASCII.GetBytes(password.Substring(i, 1))[0];
           dst[i] = key[i];
       }

    long rslt  = @key[0] + @key[1]*256 + @key[2]*65536 + @key[3]*16777216;
    one = rslt * 213119 + 2529077;
       one = one - ToInt32(one / 4294967296) * 4294967296;

    rslt  = @key[4] + @key[5]*256 + @key[6]*65536 + @key[7]*16777216;
       two = rslt * 213247 + 2529089;
       two = two - ToInt32(two / 4294967296) * 4294967296;

    rslt  = @key[8] + @key[9]*256 + @key[10]*65536 + @key[11]*16777216;
       three = rslt * 213203 + 2529589;
       three = three - ToInt32(three / 4294967296) * 4294967296;

    rslt  = @key[12] + @key[13]*256 + @key[14]*65536 + @key[15]*16777216;
       four = rslt * 213821 + 2529997;
       four = four - ToInt32(four / 4294967296) * 4294967296;

       key[3] = ParseInt(one / 16777216);
       key[2] = ParseInt((((Int32)(one - @key[3] * 16777216)) / 65535));
       key[1] = ParseInt((one - @key[3] * 16777216 - @key[2] * 65536) / 256);
       key[0] = ParseInt((one - @key[3] * 16777216 - @key[2] * 65536 - @key[1] * 256));

       key[7] = ParseInt(two / 16777216);
       key[6] = ParseInt((two - @key[7] * 16777216) / 65535);
       key[5] = ParseInt((two - @key[7] * 16777216 - @key[6] * 65536) / 256);
       key[4] = ParseInt((two - @key[7] * 16777216 - @key[6] * 65536 - @key[5] * 256));

       key[11] = ParseInt(three / 16777216);
       key[10] = ParseInt((three - @key[11] * 16777216) / 65535);
       key[9] = ParseInt((three - @key[11] * 16777216 - @key[10] * 65536) / 256);
       key[8] = ParseInt((three - @key[11] * 16777216 - @key[10] * 65536 - @key[9] * 256));

       key[15] = ParseInt(four / 16777216);
       key[14] = ParseInt((four - @key[15] * 16777216) / 65535);
       key[13] = ParseInt((four - @key[15] * 16777216 - @key[14] * 65536) / 256);
       key[12] = ParseInt((four - @key[15] * 16777216 - @key[14] * 65536 - @key[13] * 256));

       dst[0] = ParseInt(dst[0] ^ @key[0]);

       for (var i = 1; i < dst.Length; i++)
           dst[i] = ParseInt(@dst[i] ^ @dst[i - 1] ^ @key[i]);

       for (var i = 0; i < dst.Length; i++)
           if (dst[i] == 0)
               dst[i] = 102;
               
return dst;
   }

   private static int ToInt32(long val)
   {
       return Convert.ToInt32(val);
   }
   
   private static byte ParseInt(long val)
   {
       return BitConverter.GetBytes(val)[0];
   }

Posted

It's a simple conversion of every single registration script in asp/php's encryption method for storing passwords when users register.

 

Infact it's scarily alot of copy paste, just wit a few changes to C#/.NET syntax.

 

Not quite sure how it's useful, if you can't do this you wouldn't mess with it in the first place.

Posted

in English please?  ;D

That was English.

 

A side note, this hashing algorithm is notoriously insecure, and has an incredibly alarming collision rate.

You should use hAuthD and enable hint's custom md5 password encryption, which is a hell of a lot more secure.

Posted

That was English.

 

A side note, this hashing algorithm is notoriously insecure, and has an incredibly alarming collision rate.

You should use hAuthD and enable hint's custom md5 password encryption, which is a hell of a lot more secure.

 

U MAD?! U NO LIKE BRUT FOUS?!

Posted

.... what a big fuzz for nothing

Thanks for sharing your awesomeness Anders

 

If you can improve the algorithm just do so and share it?

C# is widely used to create web applications so it's not strange I'm sharing this at all.

Posted

.... what a big fuzz for nothing

Thanks for sharing your awesomeness Anders

 

If you can improve the algorithm just do so and share it?

C# is widely used to create web applications so it's not strange I'm sharing this at all.

 

Do you even know how the system of authentication works together with the first registration of a users information?

In general how authentication processes has to be tied with the user info it has from whatever previous source?

 

It sounds like you don't.

Posted

Great for pointing out that you do know how it works.

Thanks for contributing it to this topic. Really useful information.

 

Just like your fantastic useful information of saving people 3 minutes with this.

 

Lets forget the fact that'd Anarchy pointed out how crap and weak the "hash" if you can call it that is, in l2.

Not me.

 

Using a new hash, you can google for it.

Am i awesome for posting a SHA2 or ever SHA1 hash copy pasted from somewhere?

Won't really help when no authentication process known in L2 supports it, will it? ;)

 

Your a kid who's butthurt over not getting praise, but instead someone saying what you share is pretty much already shared, in another script/language.

Which is what i did - FYI - not insult you in anyway.

 

Stay in school kiddo :O

Posted

That was English.

 

A side note, this hashing algorithm is notoriously insecure, and has an incredibly alarming collision rate.

You should use hAuthD and enable hint's custom md5 password encryption, which is a hell of a lot more secure.

I think he meant he did not understand it

Posted

You must be really awesome that you can fix it in 3minutes. Thanks for pointing out how awesome you are again.

Still..  I don't really care what your opinion is about the "hash". Just shared it to I can save Anders 3min :)

(PS: I'm glad I'm still studying. Someone as awesome as you doesn't need school ;))

  • 2 weeks later...
Posted

There u go hCrypt in C#.

        using System;

       private const string MD5Password = "key";
       private static string hCrypt(string password)
       {
           var md5Password = MD5Password.ToCharArray();
           var s = (EncryptMD5(password) + EncryptMD5(MD5Password)).ToCharArray();
           int j = 0;
        for (var i = 0; i < s.Length; i++)
        {
               if (j >= MD5Password.Length) j = 0;

               var calcu = s[i] ^ md5Password[j];
            s[i] = (char)calcu;
	        j++;
        }
           return EncryptMD5(new string(s));
       }


       public static string EncryptMD5(string originalPassword)
       {
           return BitConverter.ToString(((new MD5CryptoServiceProvider()).ComputeHash(Encoding.UTF8.GetBytes(originalPassword)))).Replace("-", "").ToLower();
       }

Posted

There u go hCrypt in C#.

        private const string MD5Password = "key";
        private static string hCrypt(string password)
        {
            var md5Password = MD5Password.ToCharArray();
            var s = (EncryptMD5(password) + EncryptMD5(MD5Password)).ToCharArray();
            int j = 0;
        for (var i = 0; i < s.Length; i++)
        {
                if (j >= MD5Password.Length) j = 0;

                var calcu = s[i] ^ md5Password[j];
            s[i] = (char)calcu;
	        j++;
        }
            return EncryptMD5(new string(s));
        }


        public static string EncryptMD5(string originalPassword)
        {
            return BitConverter.ToString(((new MD5CryptoServiceProvider()).ComputeHash(Encoding.UTF8.GetBytes(originalPassword)))).Replace("-", "").ToLower();
        }

is seems good but look the first lines :S fix it!!!
  • Vision changed the title to C# L2Off Password encryption

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • L2 Kings    Stage 1 – The Awakening Dynasty and Moirai Level Cap: 83 Gear: Dynasty -Moirai & Weapons (Shop for Adena + Drop from mobs/instances ) Masterwork System: Available (Neolithics S required with neolithics u can do armor parts foundation aswell) Class Cloaks: Level 1 - Masterwork sets such us moirai/dynasty stats are boosted also vesper(stage 2) Olf T-Shirt: +6 (fails don’t reset) safe is +2 Dolls: Level 1 Belts: Low & Medium Enchant: Safe +3 / Max +8 / Attribution Easy in Moirai-Dynasty . Main Zones: Varka Outpost: Easy farm, Adena, EXP for new players = > 80- 100kk hour Dragon Valley: Main farm zone — , 100–120kk/hour Weapon Weakness System active (all classes can farm efficiently) Archers get vampiric auto-hits vs mobs Dragon Valley Center: Main Party Zone — boosted drops (Blessed enchants, Neolithics chance) => farm like 150-200kk per hour. Dragon Valley North: Spoil Zone (Asofe + crafting materials for MW) Primeval Isle: Safe autofarm zone (low adena for casual players) ==> 50kk per hour Forge of the Gods & Imperial Tomb: Available from Stage 1 (lower Adena reward in compare with Dragon Valley) Hellbound also avaliable from stage 1 In few words all zones opened but MAIN farm zone with boosted adena and drops is Dragon valley also has more mobs Instances: Zaken (24h Reuse) → Instead of Vespers drop Moirai , 100% chance to drop 1 of 9 dolls lvl 1, Zaken 7-Day Jewelry Raid Bosses (7 RBs): Drop Moirai Parts + Neolithic S grade instead of Vespers parts that has 7 Rb Quest give Icarus Weapons Special Feature 7rb bosses level up soul crystals aswell. Closed Areas : Monaster of SIlence, LOA, ( It wont have mobs) / Mahum Quest/Lizardmen off) Grand Epics: Unlocked on Day 4 of Stage 1 → Antharas, Valakas, Baium, AQ, etc ================================================================================= Stage 2 – Rise of Vespers Level Cap: 85 Gear: Moirai Armors (Adena GM SHOP / Craft/ Drop) Weapons: Icarus Cloaks: Level 2 Olf: +8 Dolls: Level 2 Belts: High & Top Enchant: Safe +3 / Max +8 Masterwork can be with Neolithics S84 aswell but higher so craft will be usefull aswell. 7 Raid Boss Quest Updated: Now works retail give vesper weapons 7rb Bosses Drops : Vespers Instances: Zaken : Drops to retail vespers + the dolls and the extra items that we added on stage 1 New Freya Instance: Added — drops vespers and instead of mid s84 weapons will drop vespers . Extra drops Blessed Bottle of Freya - drops 100% chance 1 of 9 dolls. Farm Areas Dragon Valley remains main farm New Zone : Lair of Antharas (mobs nerfed and added drop Noble stone so solo players can farm too) New Party Zone : LOA Circle   ============================================================================   Stage 3 – The Vorpal ERA Gear: Vorpal Unclock Cloaks: Level 3 Olf: +10 (max cap) Dolls: Level 3 Enchant: Safe +3 / Max +12 Farm Zones : Dragon Valley Center Scorpions becomes a normal solo zone (no longer party zone) Drops:   LOA & Knorik → Mid Weapons avaliable in drop New Party Zone Kariks Instances: Easy Freya Drops Mid Weapons Frintezza Release =================================================================================     Stage 4 – Elegia Era (Final Stage) Elegia Unlock Gear: Elegia Weapons: Elegia TOP s84 ( farmed via H-Freya/ Drops ) Cloaks: Level 5 Dolls: Level 3 (final bonuses) Enchant: Safe +6 / Max +16 Instances: Hard Freya → Drops Elegia Weapons + => The Instance will drop 2-3 parts for sure and also will be able to Join with 7 people . Party Zone will have also drop chances for elegia armor parts and weapons but small   Events (Hourly): Win: 50 Event Medals + 3 GCM + morewards Lose: 25 Medals + 1 GCM + more rewards Tie: 30 Medals + 2 GCM + more rewards   ================================================================================ Epic Fragments Currency Participating in Daily Bosses mass rewarding all players Participating in Instances (zaken freya frintezza etc) all players get reward ================================================================================ Adena - Main server currency (all items in gm shop require adena ) Event Medals (Festival Adena) - Event shop currency Donation coins you can buy with them dressme,cosmetics and premium account Epic Fragments you can buy with them fake epic jewels Olympiad Tokens you can buy many items from olympiad shop (Hero Coin even items that are on next stages) Olympiad Win = 1000 Tokens / Lose = 500 Tokens ================================================================================= Offline Autofarm Allows limited Offline farming requires offline autofarm ticket that you get by voting etc ================================================================================= Grand Epics have Specific Custom NPC that can spawn Epics EU/LATIN TIME ZONE ================================================================================= First Olympiad Day 19 December First Heroes 22 December ( 21 December Last day of 1st Period) After that olympiad will be weekly. ================================================================================= Item price and economy Since adena is main coin of server and NOT donation coins we will always add new items in gm shop with adena in order to burn the adena of server and not be inflation . =================================================================================        
    • Hello, I'd like to change a title color for custom npc.  I created custom NPC, cloned existing. I put unique id for it in npcname-e, npcgrp and database. I have "0" to serverSideName in db, so that it would use npcname-e, but instead it has "NoNameNPC"and no title color change.
    • Trusted Guy 100% ,  I asked him for some work and he did it right away.
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock