# Trying to understand creating my own file encryption program

**URL:** <https://boards.straightdope.com/t/trying-to-understand-creating-my-own-file-encryption-program/470520>\
**Category:** Factual Questions\
**Created:** [November 1, 2008, 12:56am UTC](https://boards.straightdope.com/t/trying-to-understand-creating-my-own-file-encryption-program/470520 "2008-11-01T00:56:56Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![RaftPeople](https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/32.png) [@RaftPeople](https://boards.straightdope.com/u/RaftPeople)\
**Post date:** [November 1, 2008, 11:36pm UTC](https://boards.straightdope.com/t/trying-to-understand-creating-my-own-file-encryption-program/470520/21 "2008-11-01T23:36:22Z")

</div>

> [@Deeg](#):
>
> It would be harder to crack but trivially so with today’s computing power. A better bet would be to compress the data first and remove as much redundancy as possible. Redundancy is the Achilles Heel of most cryptographic techniques. Of course, as soon as the hacker realized the data was compressed then cracking becomes a whole lot easier.

I’m making the assumption the person cracking the code does not know the algorithm that was used to encrypt.

Are you thinking that, due to computing power, a brute force method could be used? If you don’t know the algorithm, how might a brute force method work in this case?

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [November 1, 2008, 11:38pm UTC](https://boards.straightdope.com/t/trying-to-understand-creating-my-own-file-encryption-program/470520/22 "2008-11-01T23:38:35Z")

</div>

> [@](#):
>
> You don’t want to be the next guy to develop something and have it wind up being no more secure than a ROT-26 transposition.

I dunno; I think I would say that the OP’s scheme is more secure than ROT-26. In fact, I’d even go so far as to say that it’s more secure than ROT-13.

---

<div class="post-metadata">

**Author:** ![erislover](https://avatars.discourse-cdn.com/v4/letter/e/71e660/32.png) [@erislover](https://boards.straightdope.com/u/erislover)\
**Post date:** [November 1, 2008, 11:40pm UTC](https://boards.straightdope.com/t/trying-to-understand-creating-my-own-file-encryption-program/470520/23 "2008-11-01T23:40:15Z")

</div>

> [@RaftPeople](#):
>
> Here’s an additional question for crypto-types:  
> If the OP altered the algorithm to continuously be shifting the starting point of the simple translation table, how would that type of change impact the statistical analysis required to break the code? Would it be harder for an experienced crypto-type to break?
> 
> For example, for the first character in the message, the translation table starts at index 0, an input character value of 64 would go to index 64 to get the output character. For the 2nd character in the message, an input character value of 64 would go to index 65 in the table to get the output character, etc. etc. (wrapping at 256).

This reminds me of the [Solitaire Cipher](http://en.wikipedia.org/wiki/Solitaire_cipher).

---

<div class="post-metadata">

**Author:** ![dgrdfd](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@dgrdfd](https://boards.straightdope.com/u/dgrdfd)\
**Post date:** [November 2, 2008, 12:44am UTC](https://boards.straightdope.com/t/trying-to-understand-creating-my-own-file-encryption-program/470520/24 "2008-11-02T00:44:14Z")

</div>

For everyone’s information, this is simply a learning exercise. I have no intention of trying to hide important information with this.

Thanks again for replying to my thread. I will check out more information on some of the links/buzzwords thrown out/books.

---

<div class="post-metadata">

**Author:** ![Deeg](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/deeg/32/2955_2.png) [@Deeg](https://boards.straightdope.com/u/Deeg)\
**Post date:** [November 3, 2008, 8:03pm UTC](https://boards.straightdope.com/t/trying-to-understand-creating-my-own-file-encryption-program/470520/25 "2008-11-03T20:03:38Z")

</div>

> [@RaftPeople](#):
>
> I’m making the assumption the person cracking the code does not know the algorithm that was used to encrypt.
> 
> Are you thinking that, due to computing power, a brute force method could be used? If you don’t know the algorithm, how might a brute force method work in this case?

A lot of cracking algorithms look for patterns in the encrypted message that occur more (or less) often than would occur if the message was completely random. Modern techniques need only a very small pattern to crack the whole message. Compressing a message first (e.g. zipping it) will help reduce most of the redundancy in the message but it has the flaw that the first few bytes of every compressed message will contain similar information (information needed to uncompress the data) and can itself be exploited.

If you’re interested in a real-world scenario of what you’re talking about check out the cracking of the Enigma machine during WW II.

---

<div class="post-metadata">

**Author:** ![Darryl\_Lict](https://avatars.discourse-cdn.com/v4/letter/d/7cd45c/32.png) [@Darryl\_Lict](https://boards.straightdope.com/u/Darryl_Lict)\
**Post date:** [November 3, 2008, 8:41pm UTC](https://boards.straightdope.com/t/trying-to-understand-creating-my-own-file-encryption-program/470520/26 "2008-11-03T20:41:52Z")

</div>

> [@Chronos](#):
>
> I dunno; I think I would say that the OP’s scheme is more secure than ROT-26. In fact, I’d even go so far as to say that it’s more secure than ROT-13.

Heh.

[Previous page](https://boards.straightdope.com/t/trying-to-understand-creating-my-own-file-encryption-program/470520.md?page=1)
