For over ten years, I've been using mmap for my own bigtable implementation. Now, I can surely confirm that, in Linux, mmap / munmap / ftruncate / mmap implementation is buggy. If you create a file, mmap it into memory, munmap it, extend it with ftruncate, and again, mmap it into memory, program gets corrupted in unpredictable way. I tried every solution. The unique workaround for this bug is to use Linux specific mremap function instead of munmap / mmap. The bug is consistently repeated in the following scenario, for multi-threaded applications: Create 10 files, each 2 MBytes. MMap each file into memory in three segments(First segment, 4096 bytes memory as header, second 128*1024 bytes, and the third, the rest of the file) Create NumOnlineProcessors * 2 thread and concurrently: Write some data into mmap'ed segments, especially, 3rd segments. Then, extend third segment by munmap msync ftruncate (Current file size + 1 MBytes) mmap whole 3...
Have you considered actually using version control? Maybe github or bitbucket or something? Posting code on a blog is just silly.
YanıtlaSilOK Lucas, I am going to create a public repo on GITHUB
YanıtlaSilLucas:
YanıtlaSilhttps://github.com/ikizir/HohhaDynamicXOR/tree/master
Keep up the work, hope the edge cases that were brought up in the mailing list can be worked on.
YanıtlaSilThank you My8th
YanıtlaSilEvery comment, every idea, every criticism does count.
It is "our" work. You are all welcome to participate
So how do you encrypt and decrypt data with it?
YanıtlaSilI am going to write the README file on GitHUB tomorrow. OK?
YanıtlaSilOperation
YanıtlaSilM = (M ^ Body[M]) & BodyMask;
will clear all bits save those present in Bodymask, whcih is length of plainetxt minus 1.
In other words, you only use no more than 2**(bitnum) positions in Body array, where bitnum is a number of bits in binary representation of BodyMask.
Imagine that BodMask is, say, 0x10000000. That means your algorithm only chooses one of two (!!!) positions on Body array. Is it what you really mean to do?
Have you put your algorithm to real statistical tests, analyzing its real complexity and reliabilty?
Thank you Konstantin, for your attention.
YanıtlaSilI am going to fix it.
That's why I put it into public domain. We see each other's mistakes.
Thank you Konstantin. I've fixed it.
YanıtlaSilBut it was only affecting the key coverage.
Clearing the key body bytes == BodyMask is a desirable situation, since, in the next round it will be updated again.
The key is dynamically updated during the process. Clearing it is a very natural and desired situation.
You can download the code, run the tests and see the randomness with trying different bmp.
And no, I haven't applied any statistical tests or analysis.
I opened it to public as a programmer toy to improve it together.
Thank you again.
Konstantin: I've fixed the code with + op instead of XOR but, I think it will be better to leave it as it is, I mean XOR and limit the max. key body size to 256 bytes.
YanıtlaSilWhat do you think?
Hello Ismail,
YanıtlaSilOn Github, I see the same code where BodyMask is ANDed (&), thus the same problem with reducing indices amount.
Perhaps you means something like
M = (M ^ LastCipherTextVal) % BodyMask;
instead of
M = (M ^ LastCipherTextVal) & BodyMask;
but please reflect the change in all the functions on GitHub.
I haven't run serious code investigation so far, but please take into account the following:
1. The operation
LastPlainTextVal&(SALT_SIZE-1)
should perhaps be replaced with
LastPlainTextVal % SALT_SIZE
(see the problen with BodyMask for erason why
2. Studies should be made, whether the algorithm can be attacekd with rainbox tables-like approach (percomputed tables), especially if part of plaintext is known.
That is, thorough tests should be made before you offer your algorithm to the wide public. It could be sad if major vulnerability to simple attacks could be found.
I also recommend communicating with me over email, since comments here are inconvenient means, to me.
Good luck.
Thank you Konstantin,
YanıtlaSilI really appreciate your help.
I haven't your e-mail address. So I am writing here. Send your e-mail address to ikizir@gmail.com. We may continue privately.
First time you showed me that code part, I just changed the code to + instead of ^.
But the overall speed has decreased.
Then, I decided to leave it as it is and limit the max. keysize to 256 bytes(which is 2048 bits) and then leave the lines as they are.
2048 bit key size is really huge for a symmetrical algorithm. If someone needs longer keys, I can show him/her how to modify the code in order to do that.
I am using & instead of % because & is doing the same thing % does and much much much faster than % if:
BodyMask is a Mersenne Number
And the BodyMask is always guaranteed to be a Mersenne number. Because we force user to choose a key length which is a power of 2!
Using & instead of % is one of key optimization techniques of the code.
Responded by email.
YanıtlaSilGood luck!
Bu yorum bir blog yöneticisi tarafından silindi.
YanıtlaSilBu yorum bir blog yöneticisi tarafından silindi.
YanıtlaSil