fixed re-encryption of Panasonic svl.db channel list

This commit is contained in:
hbeham
2013-06-28 15:10:14 +02:00
parent 0e17902c70
commit 9cf721a26a
3 changed files with 14 additions and 10 deletions

View File

@@ -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
/// <summary>
/// XOR-based cypher which can be used to alternately crypt/decrypt data
/// </summary>
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();

View File

@@ -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;

View File

@@ -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)