Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Keepass 2.x compression levels

Thorsten
2014-02-19
2014-02-22
  • Thorsten
    Thorsten
    2014-02-19

    Hi.

    I just noticed, that Kypass on iOS uses some sort of different compression levels than keepass 2.x does?
    If I use a kdbx on PC and save it, its about 1/3 of size bigger then when I saved it last on iOS. I do see no difference in the export of the xml, so can someone explain to whats happening here?

    Regards
    Thorsten

    Edit:
    I found some hints, that also Android Version does this:
    https://groups.google.com/forum/?fromgroups#!topic/keepassdroid-discuss/_Jnd78zd1t4
    https://keepass2android.codeplex.com/discussions/446256

    If it is a setting in the GZIP-Library (like compression level), maybe it would be great to make it available in the database settings.
    I am using the databases mobile and with one database the difference is 28 KByte --> 18 KByte and I have a bigger one which I have not tested yet, which has 161 KByte as a kdbx.

     
    Last edit: Thorsten 2014-02-19
  • Thorsten
    Thorsten
    2014-02-19

    Uff, I just tested the 161 KByte File on iOS.
    The file will have 55 KByte (!!!) after usage on the iPad.
    So the compression is a lot better and makes sense for mobility (Data bandwidth and data usage).

     
  • Thorsten
    Thorsten
    2014-02-19

    My gerneral question was, if the library that is used in keepass might have different compression levels and is set to a "fast" variant.
    Maybe it is something that can even be improved by Dominik.

     
  • Dominik Reichl
    Dominik Reichl
    2014-02-19

    KeePass uses the GZipStream class [1] provided by the .NET Framework. Specifying a compression level is not supported by .NET 4.0 and earlier. In .NET 4.5, the compression was improved (by using the ZLib library), levels are supported and it defaults to best compression (not speed).

    In short: under .NET 4.5 you get a good compression, and under .NET 4.0 and earlier a moderate compression.

    Best regards,
    Dominik

    [1] http://msdn.microsoft.com/en-US/library/system.io.compression.gzipstream.aspx

     
  • Thorsten
    Thorsten
    2014-02-19

    Many thanks. That explains it. We use .Net 4.0 at work.

     
  • miguel vanhove
    miguel vanhove
    2014-02-22

    There are another reason :)

    KeePass use the class XmlTextWriter to generate the xml file.
    This class add a lot of carriage return, tabulation and spaces by default to have a good looking xml file.

    The XML generated by KyPass use [NSXMLDocument XMLDataWithOptions:NSXMLNodeCompactEmptyElement] function that doesn't add return, tabulation and spaces