// DIE's signature file
// Authors: hypn0 <hypn0@mail.ru>, Kaens (TG@kaens), LinXP

init("archive","");

function detect(bShowType,bShowVersion,bShowOptions)
{
    if(Binary.compare("a596fdff"))
    {
        bDetected=1;
        sName="FTCOMP";
    }
    else if(Binary.compare("aced00057704"))
    {
        bDetected=1;
        sName="IzPack";
    }
    else if(Binary.compare("'bvxn'"))
    {
        bDetected=1;
        sName="LZFSE";
    }
    else if(Binary.compare("'SIT!'"))
    {
        bDetected=1;
        sName="SIT";
    }
    else if(Binary.compare("06'SKF3.0'"))
    {
        bDetected=1;
        sName="SKF";
    }
    else if(Binary.compare("789c"))
    {
        bDetected=1;
        sName="ZLib";
    }
    else if(Binary.compare("'!<arch>'0a'debian-binary'"))
    {
        bDetected=1;
        sName="DEB";
    }
    else if(Binary.compare("'Archive'00................2800000064"))
    {
        bDetected=1;
        sName="ArcFS";
    }
    else if(Binary.compare("'ARCV'0002"))
    {
        bDetected=1;
        sName="ARCV 2";
    }
    else if(Binary.compare("09006bea"))
    {
        bDetected=1;
        sName="BFF";
    }
    else if(Binary.compare("00069a68"))
    {
        bDetected=1;
        sName="DCL";
    }
    else if(Binary.compare("....'-lh'..2d")||Binary.compare("....'-lz'..2d"))
    {
        sVersion = Binary.getString(2,5)
        bDetected=true;
        switch(Binary.getString(3,3))
        {
        case "lh0":
        case "lh1":
        case "lh2":
        case "lh3":
        case "lh4":
        case "lh5":
        case "lh6":
        case "lh7":
        case "lhd": sName="LHA archive (.LHA)"; break;
        case "lh8":
        case "lh9":
        case "lha":
        case "lhb":
        case "lhc":
        case "lhe": sName="LHA archive, Joe Jared ext (.LHA)"; break;
        case "lhx": sName="LHA archive, UNLHA32 ext (.LHA)"; break;
        case "lzs":
        case "lz2":
        case "lz3":
        case "lz4":
        case "lz5":
        case "lz6":
        case "lz7":
        case "lz8": sName="LHA archive, LArc ext (.LZS)"; break;
        default: bDetected=false;
        }
    }
    else if(Binary.compare("'mflh'0100"))
    {
        bDetected=1;
        sName="MVA";
    }
    else if(Binary.compare("'ViG'....1a"))
    {
        bDetected=1;
        sName="PaperPort";
    }
    else if(Binary.compare("'sqsh'0000"))
    {
        bDetected=1;
        sName="SquashFS";
        sOptions="big endian";
    }
    else if(Binary.compare("'hsqs'0300"))
    {
        bDetected=1;
        sName="SquashFS";
        sOptions="little endian";
    }
    else if(Binary.compare("'im001V'......50....0000"))
    {
        sName="SW";
        bDetected=1;
        var arch_offset=Binary.readByte(0x0e)+15;
        if(Binary.compare("1f9d", arch_offset))
        {
            sOptions="Z archive";
        }
        else if(Binary.compare("1f1e", arch_offset))
        {
            sOptions="PACK 2 archive";
        }
    }
    else if(Binary.compare("0001000401000100010000000000000000000000000000000000000000000000010101"))
    {
        bDetected=1;
        sName="VMS SaveSet";
    }
    else if(Binary.compare("'ZOO'............'Archive'"))
    {
        bDetected=1;
        sName="ZOO";
    }
    else if(Binary.compare("602213636c00"))
    {
        bDetected=1;
        sName="Asymetrix";
    }
    else if(Binary.compare("453dcd28........................'Compressed ROMFS'"))
    {
        bDetected=1;
        sName="CRAMFS";
    }
    else if(Binary.compare("'IsZ!@'01"))
    {
        bDetected=1;
        sName="Zipped ISO Disk Image (.ISZ)";
        switch(Binary.read_uint32(0x10))
        {
        case  0:  sOptions="no password";       break;
        case  1:  sOptions="password";          break;
        case  2:  sOptions="password, aes128";  break;
        case  3:  sOptions="password, aes182";  break;
        case  4:  sOptions="password, aes256";  break;
        }
    }
    else if(Binary.compare("aa59f0000002"))
    {
        bDetected=1;
        sName="SaveDskF";
    }
    else if(Binary.compare("'AlB'1a"))
    {
        bDetected=1;
        sName="BeOS package";
    }
    else if(Binary.compare("'BIGF'00"))
    {
        bDetected=1;
        sName="BIGF";
    }
    else if(Binary.compare("01ca'Copyright (c) Genus Microprogramming, Inc.'"))
    {
        bDetected=1;
        sName="GXL";
    }
    else if(Binary.compare("0100......00ecf9"))
    {
        bDetected=1;
        sName="INSA";
    }
    else if(Binary.compare("..0fd28ccc1f..3c0d8e830dd88f25ac"))
    {
        bDetected=1;
        sName="InstallShield ISN";
    }
    else if(Binary.compare("135d658c3a010200"))
    {
        bDetected=1;
        sName="InstallShield";
        sVersion="3.x"
    }
    else if(Binary.compare("2aab79d800010000"))
    {
        bDetected=1;
        sName="InstallShield INST";
        sVersion="3.x"
    }
    else if(Binary.compare("'SZDD'88"))
    {
        bDetected=1;
        sName="SZDD";
        sOptions="by Microsoft";
    }
    else if(Binary.compare("'KWAJ'88"))
    {
        bDetected=1;
        sName="KWAJ";
        sOptions="by Microsoft";
    }
    else if(Binary.compare("'MDmd'"))
    {
        bDetected=1;
        sName="MDCD";
    }
    else if(Binary.compare("'MPQ'1a"))
    {
        bDetected=1;
        sName="MPQ";
        sOptions="by Blizzard";
    }
    else if(Binary.compare("'_MCT'00'KSLZ'789c"))
    {
        bDetected=1;
        sName="MSKN 2";
        sOptions="zlib";
    }
    else if(Binary.compare("'PACK'............0000"))
    {
        bDetected=1;
        sName="PACK";
    }
    else if(Binary.compare("00000000000000000000000000007400010074000500"))
    {
        bDetected=1;
        sName="PCInstall";
    }
    else if(Binary.compare("'PP20'09"))
    {
        bDetected=1;
        sName="PP20";
    }
    else if(Binary.compare("edabeedb0300"))
    {
        bDetected=1;
        sName="RPM package";
    }
    else if(Binary.compare("bd01..00..00..000000"))
    {
        bDetected=1;
        sName="HUFF";
    }
    else if(Binary.compare("'SZ '88"))
    {
        bDetected=1;
        sName="SZ";
        sOptions="by Microsoft";
    }
    else if(Binary.compare("'BAGF'02"))
    {
        bDetected=1;
        sName="BAGF";
    }
    else if(Binary.compare("'PAC - 'a9' BVRP Software 1990-2000'"))
    {
        bDetected=1;
        sName="PAC";
        sOptions="1990-2000 by BVRP Software";
    }
    else if(Binary.compare("'Cr24'02"))
    {
        bDetected=1;
        sName="CRX";
    }
    else if(Binary.compare("74c42c84e1e5d428"))
    {
        bDetected=1;
        sName="InstallShield INX";
        sVersion="7.x"
    }
    else if(Binary.compare("5d0000....ffffffffffffffff00180ddd04"))
    {
        bDetected=1;
        sName="LZMA";
    }
    else if(Binary.compare("1fa0"))
    {
        bDetected=1;
        sName="SCO";
    }
    else if(Binary.compare("'# PaCkAgE DaTaStReAm'"))
    {
        bDetected=1;
        sName="Solaris Package";
    }
    else if(Binary.compare("'SQZE'010000"))
    {
        bDetected=1;
        sName="SQZE";
    }
    else if(Binary.compare("'xar!'001c00010000"))
    {
        bDetected=1;
        sName="XAR";
    }
    else if(Binary.compare("fd'7zXZ'0000"))
    {
        bDetected=1;
        sName="XZ";
    }
    else if(Binary.compare("1f9d"))
    {
        bDetected=1;
        sName="Z";
    }
    else if(Binary.compare("'LZK00'000000"))
    {
        bDetected=1;
        sName="LZK00";
    }
    else if(Binary.compare("032401010100"))
    {
        bDetected=1;
        sName="WPK";
    }
    else if(Binary.compare("'TPWM'"))
    {
        bDetected=1;
        sName="TPWM (BlueByte)";
    }
    else if((Binary.getSize()>=500)&&(Binary.compare("00'ustar'",0x100)))
    {
        bDetected=1;
        sName="tar";
    }
    else if(Binary.compare("'LB'0100")) {
        bDetected=1;
        sName="XFL game resource file (.XFL)";
        sVersion="v1.0";
        sOptions=sOptions.append(Binary.getString(12,32));
        sOptions=sOptions.append("& other "+(Binary.readDword(8)-1)+" files");
    }
    else if(Binary.compare("FF060000'sNaPpY'")) {
        bDetected=true;
        sName="Snappy compressed data (.SZ)";
    }
    else if(Binary.compare("'blkzip'00")) {
        bDetected=true;
        sName="BulkZip Archive (.BULK)";
    }
    else if(Binary.compare("AE01'NanoZip 0.09 alpha'")) {
        bDetected=true;
        sName="NanoZip Archive (.NZ)";
        sVersion = "0.09 alpha";
    }
    else if(Binary.compare("'CM'2805060000")) {
        bDetected=true;
        sName="RAZOR Archive (.RZ)";
    }
    else if(Binary.compare("28B52FFD")) {
        bDetected=true;
        sName="Facebook Zstandard/ZSTD compressed data (.ZST)";
    }
    return result(bShowType,bShowVersion,bShowOptions);
}
