Re: Get ASCII value for character when higher than 127



On 5 jun, 18:29, MrAsm <m...@xxxxxxx> wrote:
However, this is my C++ and C# code, that works.

On 5 jun, 17:54, Alex Blekhman <x...@xxxxxxxxx> wrote:
I think that because of wrong `free' calls the process'
memory became corrupted. That's why you see weird problems.

MrAsm, you are not using the same way to XOR as I do, so your
endresult will be different than mine. Maybe that is why your code
works correct? Since I do save the ascii values to the text file, I
cannot imagine that the binary part is the problem.

I've removed all the illegal free-commands. It still isn't clear to me
when you need to free a char and when not, but if you guys say that
they have to go, I wouldn't doubt that ;-)

Still, I keep having the same problems.

The reason why I use string& in stead of just string is because
someone told me to (I think it was in the sample code made by Alex)

All my code comes from samples that I find on the internet. I need to
do something, find a sample that does is, and am glad if it does
work!!

For example, you asked me "We are in C++ world, why do you use malloc/
calloc instead of new?" Well, I found this code in a sample, and it
seemed to do what I wanted, get a string from a PUNICODE_STRING that I
want to write to a textfile. You now say that it is wrong to do it
this way, but I really have no idea why. I'll try to use your hints,
but am not sure if I will get it to work. Again, I have no C++
knowledge what so ever, and don't have the time to get it either, this
project should be finished as soon as possible.

Unfortunately, my boss thinks that when you know how to program C#,
you also know C++. And that of course is not really the case.

So, any more tips on why sometimes my '\0' character gets converted to
the wrong int value, depending on the character that's before it, are
very welcome, since I hardly know what I am doing ;-)

I'd prefer to adjust something to my code in stead of rewriting parts
all over again (like trying a complete new XOR, or writing binary in
stead of int values to text), since it seems to work most of the
times, only not all the time.

So I must be really close to getting something that works completely.
If I have to rewrite complete parts of my code I'm afraid it will take
longer until I get it finished :-(

Thanks again,
Sandra

.



Relevant Pages

  • Re: Preventing large runs of identical bits.
    ... way I can xor the xor result, and repeat that process X times, so that ... the chance of that input string creating a constant bit string ... I'm using it for an encryption algorithm I'm writing, ... I'm asking it in the compression newsgroup rather than an encryption ...
    (comp.compression)
  • Encryption A97
    ... I've been playing with some encryption code from the web ... and have been pleased with this sample code from Rob Bovey. ... Essentially it takes a string and puts it through an XOR process and saves ...
    (microsoft.public.access.modulesdaovba)
  • Re: Hashing a password
    ... This is the password hashing ... I take it that the hash key is some 8 bit binary code? ... string value in PHP may be larger than 8 bits, ... That would make the XOR ...
    (comp.lang.php)
  • Re: Get ASCII value for character when higher than 127
    ... this is my C++ version of XOR function: ... // Crypt a string using XOR. ... // is not copied into the destination array. ... const std::string & value, ...
    (microsoft.public.vc.language)
  • Re: Web Service Return type for Vector
    ... How can i specify if i wan to return the vector in stead of just a string. ...
    (comp.lang.java.programmer)

Loading