• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[System] AES

Level 31
Joined
Jul 10, 2007
Messages
6,306
althouh IDK what's the purpose of this, but can you just merge all your submissions related to this one in this thread and put it in a test map (it's already required in submitting a resource)...

Ok, you should know this.

1. The description is more than sufficient. You aren't getting anything else out of me. If you don't know the purpose and you are too lazy to google AES and look at the first result, that's your problem, not mine.

2. Are you kidding me with merging them all into one resource? Yea, that's never going to happen. You are talking to the person that advocates modularity and minimalism at all costs. All of the resources here can be used for more purposes than AES, so they do not belong in the AES lib. The only things that belong in the AES lib are the AES specific data structures and AES specific algorithms.

Think of it like this. AES simply uses those resources, but those resources are resources on their own. It's like asking me to hardcode a Unit Indexer into every system that requires unit indexing. It's completely unreasonable. Only noobs with no design sense do that.

Now, I do agree that the sbox and rsbox can't possibly be used for anything else other than encryption, but there are various encryption schemes besides the general AES that use the sbox and rsbox. There are also different types of AES, namely 128, 192, and 256 bit. This is 128 bit. It wouldn't make sense to include sbox in each of those... it makes more sense to make it a standalone resource and make the 3 AES libs use it. That's 1/3 of the code.

Are you telling me you are all for mass identical code and cnp?

3.
put it in a test map (it's already required in submitting a resource)

no it isn't... rofl

no such rule exists mate
 
Level 17
Joined
Jul 17, 2011
Messages
1,864
haha all of these libraries are for that i/o system arent they i kinda think that once ur finished with this save load no one will be able to use it because its too advanced but you should finish it anyways :D and a question: can you save integers or reals in a gamecache in multiplayer and then load them in the next time you play the map i think you can because i made a map banlist ( you leave, the map saves your name, you get banned) once but i forgot if it worked if not then how is this system going to reload data to a map??
 
Awesome stuff. But what I'm wondering is: Isn't that one of those resources that was written "because we can"?

Not that encryption isn't helpful with Save/Loads, I just feel that this is like killing rabbits with ... well ... a nuke.

In the end, if you want to cheat in a WC3 map, there are WAY EASIER ways to do that than decrypting the save/load system.
In fact, hacking a map is so ridicolously easy that people wouldn't even bother to read an unencrypted BigInt number, even if they knew the MaxInts and the order of the data storage.

Dont get me wrong; this is awesome stuff. But its just never neccesary; even a simple long-keyed caesar cipher is enough for most cases to scare off all deciphering attempts of your average hacker (and instead just hack the map and put a cheatpack in).
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Here is an example of AES in action! : D

You'll see that it pads 0s to the end because the data isn't a full 128 bits

JASS:
struct Testing extends array
    private static hashtable hex = InitHashtable()
    
    private static method toBitStr takes string str returns string
        local string s = ""
        local integer i = StringLength(str)
        
        loop
            set s = LoadStr(hex, StringHash(SubString(str, i - 1, i)), 0) + s
        
            exitwhen 0 == i
            set i = i - 1
        endloop
        
        return s
    endmethod
    private static method init takes nothing returns nothing
        local BitInt i = BitInt.create()
        local BitInt cipherI = BitInt.convertString(toBitStr("2b28ab097eaef7cf15d2154f16a6883c"), 4)
        local AES_Data cipher = AES_Data.create()
        local AES_Data data = AES_Data.create()
        local AES aes
        local BitInt dataI
        
        call i.write(1, 1)
        call i.write(-343, 32)
        call i.write(1, 1)
        call i.write(14, 11)
        call i.write(19, 9)
        
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60000,i.toString())
        
        call cipher.load(cipherI, 0)
        call cipherI.destroy()
        set aes = AES.create(cipher)
        
        call data.load(i, 0)
        call aes.encrypt(data)
        set dataI = data.toBitInt()
        
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60000,dataI.toString())
        
        call aes.decrypt(data)
        call dataI.destroy()
        set dataI = data.toBitInt()
        
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60000,dataI.toString())
        
        call dataI.destroy()
        call i.destroy()
    endmethod
    
    private static method onInit takes nothing returns nothing
        call SaveStr(hex, StringHash("0"), 0, BitInt.charTable[0])
        call SaveStr(hex, StringHash("1"), 0, BitInt.charTable[1])
        call SaveStr(hex, StringHash("2"), 0, BitInt.charTable[2])
        call SaveStr(hex, StringHash("3"), 0, BitInt.charTable[3])
        call SaveStr(hex, StringHash("4"), 0, BitInt.charTable[4])
        call SaveStr(hex, StringHash("5"), 0, BitInt.charTable[5])
        call SaveStr(hex, StringHash("6"), 0, BitInt.charTable[6])
        call SaveStr(hex, StringHash("7"), 0, BitInt.charTable[7])
        call SaveStr(hex, StringHash("8"), 0, BitInt.charTable[8])
        call SaveStr(hex, StringHash("9"), 0, BitInt.charTable[9])
        call SaveStr(hex, StringHash("a"), 0, BitInt.charTable[10])
        call SaveStr(hex, StringHash("b"), 0, BitInt.charTable[11])
        call SaveStr(hex, StringHash("c"), 0, BitInt.charTable[12])
        call SaveStr(hex, StringHash("d"), 0, BitInt.charTable[13])
        call SaveStr(hex, StringHash("e"), 0, BitInt.charTable[14])
        call SaveStr(hex, StringHash("f"), 0, BitInt.charTable[15])
    
        call TimerStart(CreateTimer(),0,false,function thistype.init)
    endmethod
endstruct

JASS:
struct Testing extends array
    private static hashtable hex = InitHashtable()
    
    private static method toBitStr takes string str returns string
        local string s = ""
        local integer i = StringLength(str)
        
        loop
            set s = LoadStr(hex, StringHash(SubString(str, i - 1, i)), 0) + s
        
            exitwhen 0 == i
            set i = i - 1
        endloop
        
        return s
    endmethod
    private static method init takes nothing returns nothing
        local BitInt i = BitInt.create()
        local BitInt cipherI = BitInt.convertString(toBitStr("2b28ab097eaef7cf15d2154f16a6883c"), 4)
        local AES_Data cipher = AES_Data.create()
        local AES_Data data = AES_Data.create()
        local AES aes
        
        call i.write(1, 1)
        call i.write(-343, 32)
        call i.write(1, 1)
        call i.write(14, 11)
        call i.write(19, 9)
        
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60000,i.toString())
        
        call cipher.load(cipherI, 0)
        call cipherI.destroy()
        set aes = AES.create(cipher)
        
        call data.load(i, 0)
        call aes.encrypt(data)
        call data.unload(i, 0)
        call data.load(i, 5)
        call aes.encrypt(data)
        call data.unload(i, 5)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60000,i.toString())
        
        call aes.decrypt(data)
        call data.unload(i, 5)
        call data.load(i, 0)
        call aes.decrypt(data)
        call data.unload(i, 0)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60000,i.toString())
        
        call i.destroy()
    endmethod
    
    private static method onInit takes nothing returns nothing
        call SaveStr(hex, StringHash("0"), 0, BitInt.charTable[0])
        call SaveStr(hex, StringHash("1"), 0, BitInt.charTable[1])
        call SaveStr(hex, StringHash("2"), 0, BitInt.charTable[2])
        call SaveStr(hex, StringHash("3"), 0, BitInt.charTable[3])
        call SaveStr(hex, StringHash("4"), 0, BitInt.charTable[4])
        call SaveStr(hex, StringHash("5"), 0, BitInt.charTable[5])
        call SaveStr(hex, StringHash("6"), 0, BitInt.charTable[6])
        call SaveStr(hex, StringHash("7"), 0, BitInt.charTable[7])
        call SaveStr(hex, StringHash("8"), 0, BitInt.charTable[8])
        call SaveStr(hex, StringHash("9"), 0, BitInt.charTable[9])
        call SaveStr(hex, StringHash("a"), 0, BitInt.charTable[10])
        call SaveStr(hex, StringHash("b"), 0, BitInt.charTable[11])
        call SaveStr(hex, StringHash("c"), 0, BitInt.charTable[12])
        call SaveStr(hex, StringHash("d"), 0, BitInt.charTable[13])
        call SaveStr(hex, StringHash("e"), 0, BitInt.charTable[14])
        call SaveStr(hex, StringHash("f"), 0, BitInt.charTable[15])
    
        call TimerStart(CreateTimer(),0,false,function thistype.init)
    endmethod
endstruct
 
Top