// DIE's signature file
// Author: LinXP
// doc-ref: https://peazip.github.io/pea_help.pdf
init("archive","");

function detect(bShowType,bShowVersion,bShowOptions)
{
    if(Binary.getSize()>=10)
    {
        if(Binary.compare("EA") && Binary.compare("0000'POD'00", 0x0A))
        {
            bDetected=true;
            sName ="PeaZip Archive (.PEA)";
            sVersion="v"+Binary.read_uint8(0x01)+"."+Binary.read_uint8(0x02)

            if(bDetected && Binary.isVerbose())
            {
                switch(Binary.read_uint8(0x3))
                {
                    case 0:  sOption("NOALGO"); break;
                    case 1:  sOption("ADLER32"); break;
                    case 2:  sOption("CRC32"); break;
                    case 3:  sOption("CRC64"); break;
                    case 16: sOption("MD5"); break;
                    case 17: sOption("RIPEMD160"); break;
                    case 18: sOption("SHA1"); break;
                    case 19: sOption("SHA256"); break;
                    case 20: sOption("SHA512"); break;
                    case 21: sOption("WHIRLPOOL"); break;
                    case 22: sOption("SHA3_256"); break;
                    case 23: sOption("SHA3_512"); break;
                    case 24: sOption("BLAKE2S"); break;
                    case 25: sOption("BLAKE2B"); break;
                    default: bDetected=false; 
                }
            }
        }
    }

    return result(bShowType,bShowVersion,bShowOptions);
}
