hello everybody ,(sorry for my basd english )
i'm trying to make a program that stores passwords in a encoded text file, but i cant encode it. and i have no idea where i have to search for.
readgards. carlon
hello everybody ,(sorry for my basd english )
i'm trying to make a program that stores passwords in a encoded text file, but i cant encode it. and i have no idea where i have to search for.
readgards. carlon
What kind of encoding? If the file is already encoded, you first need to decode it and then encode it again.
i dont know recomend me something ive tried ascii but it didint work out
A few questions that you should answer before we continue:
- What do you mean by an "encoded text file"?
- Do you have control over this "encoding" format?
- What is the purpose of storing passwords in this file?
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Also, "encoding" is just a way of representing information, and is not at all a method of implementing security. If you are dealing with passwords, you may want to be "encrypting" instead.How did it not "work out"? ASCII is a simple human-readable, plain-text. So if you did a simple output to a file, its being encoded as ASCII. Other methods of encoding, to support Unicode, is UTF8, UTF16, UTF32. UTF8 is a very popular and efficient method of encoding. There are other, non-portable methods such as Windows-specific encodings, Mac-specific encodings, etc.ive tried ascii but it didint work out
Again, you may just want "encryption", so if thats the case do a simple search for C++ encryption algorithms/examples. Encrypting can be as simple as taking a character, adding one to it, and storing it. In order to decrypt it, you do the inverse function, so you subtract 1 from it. So "secret" would be encrypted as "tfdsfu". Of course this is a very weak encryption, though.
If you want simple encryption, then replace each alphabets with some other alphabets or symbol, like a = @@#, b = @#@ etc and then store it. Then when you decrypt it, just reverse the process... ?
You still have not answered this question: what is the purpose of storing passwords in this file?
Furthermore, are you just doing this for learning purposes, or are you actually trying to write say, a password manager for your own use for real?
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
I gave a very trivial example in my previous post. Again, that example is, for encrypting you can add some constant to each character (say add 1). Thus, for decrypting you do the inverse: you subtract 1. So an input character 'a' is encrypted as 'b'.
The type of encryption you need, I think, heavily relies on the application. If you just want to learn about it for your own benefit or personal use, then some simple one that you write is good enough. If you're writing some public real-world application, then you'd want an actually secure one, then you'd be best off using an existing one (search for encryption algorithms/libraries). Any useful encryption algorithm is heavily mathematical with a lot of theoretical foundations, and it would be extremely difficult to write a useful one yourself. However, if you're working on a Masters or PhD in Computer Science or Math, then this is an excellent route to explore.
Of course. But here's the point: if you want to store the passwords in order to implement say, some kind of authentication system, then you would satisfy the need for secrecy by using a cryptographic hash, possibly with a "salt", because you just need to compare the hash digests in order to authenticate.Originally Posted by chikaij
But if you want to store the passwords in order to implement say, a "password safe", then you would need to use an encryption algorithm, and the user would need to supply some kind of password so that the secret keys of the encryption algorithm would ultimately be available for decryption (i.e., you cannot just store the secret keys in the clear, otherwise the whole scheme would be useless).
So, it is not just a matter of "oh, I want to store passwords in a file such that people reading the file cannot read them; what algorithm do you suggest?" The bigger picture of what you are trying to do should be clear.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)