Whats the best way to shrink a large body of text? [closed] - encryption

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Suppose im given a large essay. Whats the best method available to shrink it down into a small string of letters which I can decode later? Suppose Im allowed to keep a set of predefined keys if i need to?

Assuming the text is English and you want to minimize the size of the "small string", you will find a number of algorithms here: http://www.maximumcompression.com/data/text.php
For ease-of-implementation, however, you might simply want to use zlib, as it's generally available.
Further, if you want to encrypt the compressed text, you should use AES in CTR mode (and possibly appending an HMAC; ref: http://www.daemonology.net/blog/2009-06-11-cryptographic-right-answers.html).
Finally, assuming that by "asring of letters" you meant "a string of letters", you could base-64 encode the encrypted data, which would give you a string of letters, numbers, and a limited amount of punctuation.

Related

How can I made a data encryption method? (SHA256, Base64, etc.) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I would love to make my own data encryption method like Base64 and such. (preferably in Python.)
Would it be secure if I assigned "a" to for say a random number between 1-100 and a random letter or such. (for example 53f) and other letters are combinations and its random. But then how would I make a decoder, sorry for the long question haha. Thanks!
Do not start by making your own encryption method. Start by reading Bruce Schneier's Memo to the Amateur Cipher Designer.
Then write your own versions of the simpler existing ciphers: Caesar, Vigenere, (both of historical interest) RC4, Feistel. That will help you with the structure of ciphers, particularly RC4 -- a stream cipher and Feistel -- a block cipher framework.
Base64 is not a cipher, as has been pointed out. It is a useful exercise to write your own Base64 encoder/decoder, though most modern languages include one in their library anyway. That exercise helps you practice bit manipulations.
When you have done all that, find an implementation of AES that you are happy using. Any cipher you devise will not be as secure as AES.

Can you make a DFA/NFA/ Lambda NFA for determining whether a number is prime or not? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
As the title says, is it possible?
No, this isn’t possible. There are several ways you can encode “the set of all prime numbers” as a language, and the standard ways of doing so (writing the number out in binary, writing out a number of tally marks equal to the number, etc.) aren’t regular.
Formally proving this is a bit tricky but is doable using either the pumping lemma for regular languages or the Myhill-Nerode theorem. The crux of the arguments boil down to the fact that replicating parts of prime numbers repeatedly will eventually give you a non-prime number, and that’s where the technical details of the proofs come in.
Hope this helps!

What is this encryption type? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have these two encoded strings but I can't figure it out what type of encryption was used to encode:
lgGggAJp03czFtABAQAbAGlzU2FsZT1GYWxzZSNwcm9kdWN0SWQ9MTAwMQEBARXgQOoQm2IxgpYaAMcu5PS9BxkOQ7H6ezQsZZ4LjqHl5qOQgJQAESr3N5xVvZ5MCg==
and this:
b/d19ASvboAn5QBDCVieHoNTokXm0EaJKcSfrgwPlKykTKcIf7hhAibrCYuP0fK8dLH0SKvF6JWuZUftc7bG8wsVhn1uHX5Q4A6VR3POJ8zdbhiHkTcgQwG8wYYpsP3Vn8hLuoOrZbj6FAqO76GkrBYVfDYyF7GYHXdtBZQm4Dk=
I used base64 but it doesn't work.
Looks like Base64 to me. Any time I see encoding ending with '=' or '==' it is my first guess. I can see 'sales' and 'product id' after decoding your first example though it isn't completely readable. May be double encoded or have other non-printable characters as field delimiters. Hopefully this gets you heading in the right direction.

using cryptographichash in Qt [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am making a program in Qt5.2.1 and in it I am using a text file to store some data. I would like to encrypt it and decrypt it inside the program and display the text stored in the file in a QPlainTextEdit ( or any other similar widget).
I searched and came across Qcryptographichash but i have no idea how to use it. I read somewhere that it does not provide a very secure encryption but that doesn't matter ( I am not expecting hackers to try and read this file).
So, could anyone guide me in the right direction, maybe even give me some code. :D
QCryptographic hash creates a hash from given data. That is a one-way process, so the it will not do what you want, namely encrypt the data in a form that can be retrieved via decryption.
You can read more about the difference between encryption and hashes here.
You need to research into possible encryption algorithms. To my knowledge, that's not something that is part of Qt.
It's a large area of on-going research; there are so many to choose from, as you can see here.

Is it "correct" to do a binary mathematical operation by converting to decimal? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Is it considered correct in order to do a binary or hexadecimal operation to convert to decimal, do the operation, and then convert back to the original numeral system?
Is the above not advised?
Is the above frawned upon?
The context is a (first year) Programming Open University Course and the guide (in lack of a better word to describe him) is delaying my enquiry.
Yes, it's generally correct. Numbers are numbers, no matter how you represent them as text. Note that binary, decimal, and hexadecimal are all text representations of numbers.

Resources