From 9cf721a26aea62ce15b9af6e8c801021fd84e50e Mon Sep 17 00:00:00 2001 From: hbeham Date: Fri, 28 Jun 2013 15:10:14 +0200 Subject: [PATCH] fixed re-encryption of Panasonic svl.db channel list --- ChanSort.Loader.Panasonic/Serializer.cs | 13 +++++++------ ChanSort/MainForm.cs | 2 +- readme.txt | 9 ++++++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/ChanSort.Loader.Panasonic/Serializer.cs b/ChanSort.Loader.Panasonic/Serializer.cs index 1237a8e..343ee4e 100644 --- a/ChanSort.Loader.Panasonic/Serializer.cs +++ b/ChanSort.Loader.Panasonic/Serializer.cs @@ -340,7 +340,7 @@ namespace ChanSort.Loader.Panasonic File.Delete(tempFile); Application.ApplicationExit += CleanTempFile; if (cypherMode == CypherMode.Encryption) - this.CypherFile(this.FileName, tempFile); + this.CypherFile(this.FileName, tempFile, false); else this.RemoveHeader(this.FileName, tempFile); return tempFile; @@ -366,17 +366,18 @@ namespace ChanSort.Loader.Panasonic /// /// XOR-based cypher which can be used to alternately crypt/decrypt data /// - private void CypherFile(string input, string output) + private void CypherFile(string input, string output, bool encrypt) { byte[] fileContent = File.ReadAllBytes(input); int chiffre = 0x0388; int step = 0; - for (int i = 0; i < fileContent.Length /*- 41*/; i++) + for (int i = 0; i < fileContent.Length; i++) { byte b = fileContent[i]; - fileContent[i] = (byte)(b ^ (chiffre >> 8)); + byte n = (byte) (b ^ (chiffre >> 8)); + fileContent[i] = n; if (++step < 256) - chiffre += b + 0x96A3; + chiffre += (encrypt ? n : b) + 0x96A3; else { chiffre = 0x0388; @@ -568,7 +569,7 @@ order by s.ntype,major_channel case CypherMode.None: break; case CypherMode.Encryption: - this.CypherFile(this.workFile, this.FileName); + this.CypherFile(this.workFile, this.FileName, true); break; case CypherMode.HeaderAndChecksum: this.WriteFileWithHeaderAndChecksum(); diff --git a/ChanSort/MainForm.cs b/ChanSort/MainForm.cs index 7d03fcd..8ac8664 100644 --- a/ChanSort/MainForm.cs +++ b/ChanSort/MainForm.cs @@ -24,7 +24,7 @@ namespace ChanSort.Ui { public partial class MainForm : XtraForm { - public const string AppVersion = "v2013-06-28"; + public const string AppVersion = "v2013-06-28.2"; private const int MaxMruEntries = 5; diff --git a/readme.txt b/readme.txt index a49c816..f6d95bb 100644 --- a/readme.txt +++ b/readme.txt @@ -1,6 +1,7 @@ -Version v2013-06-28 ====================================================== +Version v2013-06-28.2 ==================================================== Changes: +- FIX: Error saving Panasonic svl.db file (incorrect encryption) - FIX: Error saving a Panasonic file after applying a reference list - Improved experimental support for Panasonic channel lists @@ -102,8 +103,10 @@ OTHER DEALINGS IN THE SOFTWARE. Change log ================================================================ -2013-06-27 -- Improved experimental support for Panasonic channel lists (svl.db, svl.bin) +2013-06-28.2 +- FIX: Error saving Panasonic svl.db file (incorrect encryption) +- FIX: Error saving a Panasonic file after applying a reference list +- Improved experimental support for Panasonic channel lists 2013-06-25 - Added experimental support for Panasonic channel lists (svl.db, svl.bin)