https://linen.dev logo
Title
b

bright-gpu-74537

05/25/2023, 1:44 PM
haxe
import haxe.Serializer;
import haxe.crypto.Md5;

class MyClass {
    public var id:Int;
    public var name:String;
    
    public function new(id:Int, name:String) {
        this.id = id;
        this.name = name;
    }
}

class Main {
    static function main() {
        var myObject = new MyClass(1, "John Doe");
        
        // Serialize the object to a string
        var serializedString = Serializer.run(myObject);
        
        // Hash the serialized string using MD5 algorithm
        var hash = Md5.encode(serializedString);
        
        trace("Hashed value: " + hash);
    }
}