- My own encryption program - 2 Updates
- std::array is packed, unpadded and can be casted? - 9 Updates
- Structured binding considered harmful - 8 Updates
David Brown <david.brown@hesbynett.no>: Mar 19 09:00AM +0100 On 18/03/2020 23:11, Chris M. Thomasson wrote: >> Make sure to give the folks over on sci.crypt a chance to take a look. > Fwiw, I am at a point where they are telling me that my cipher is beyond > their expertise. Note that this might be a good thing, or it might be a bad thing. It means both "I can't see a way to crack this" and "I can't see if there is a fundamental weakness". For an encryption system to be used by others or for real applications, being understood fully by other encryption experts is an absolute requirement. That shouldn't stop you (Chris and Frederick) playing around, having fun, trying stuff, learning stuff. But it /should/ stop you using your own encryption stuff for anything serious. |
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Mar 19 12:42PM -0700 On 3/19/2020 1:00 AM, David Brown wrote: > is a fundamental weakness". For an encryption system to be used by > others or for real applications, being understood fully by other > encryption experts is an absolute requirement. Agreed. I know a lot about HMAC, but not enough to say my work with it is okay. I need HMAC experts to jump on board wrt trying to literally tear it apart at every point possible. Or, I might have to pay somebody. > That shouldn't stop you (Chris and Frederick) playing around, having > fun, trying stuff, learning stuff. But it /should/ stop you using your > own encryption stuff for anything serious. Agreed. I still cannot remove the word "Experimental" from the actual name of my cipher: Experimental HMAC Cipher http://funwithfractals.atspace.cc/ct_cipher therefore, it is lingering in this experimental state. Fun times! ;^o |
Frederick Gotham <cauldwell.thomas@gmail.com>: Mar 19 04:46AM -0700 In C++11, is std::array packed, unpadded, and castable? Can I do the following? void Func(array<char,4> &a, array<char,4> &b, array<char,4> &c) { } auto main(void) -> int { array<char,12> abc; Func( *reinterpret_cast<array<char,4> *>(&abc[0]), *reinterpret_cast<array<char,4> *>(&abc[4]), *reinterpret_cast<array<char,4> *>(&abc[8]) ); } I might go back to normal arrays if there's no nice way of doing this in C++11. |
cdalten@gmail.com: Mar 19 04:54AM -0700 On Thursday, March 19, 2020 at 4:47:14 AM UTC-7, Frederick Gotham wrote: > ); > } > I might go back to normal arrays if there's no nice way of doing this in C++11. Remind me to NEVER grant you the first interview for any kind of programming job at my firm. |
Bonita Montero <Bonita.Montero@gmail.com>: Mar 19 12:59PM +0100 Am 19.03.2020 um 12:46 schrieb Frederick Gotham: > *reinterpret_cast<array<char,4> *>(&abc[8]) > ); > } Why should someone do this ? You could stick with pointers, iterators or a span. |
Jorgen Grahn <grahn+nntp@snipabacken.se>: Mar 19 12:07PM On Thu, 2020-03-19, Frederick Gotham wrote: > ); > } > I might go back to normal arrays if there's no nice way of doing this in C++11. If you need an object which can be seen as a sequence of 12 chars /or/ as three sequences of four chars, write your own class for it, one that's tailored to your special problem and your needs. void Func(Foo& abc); int main() { Foo abc; Func(abc); } Internally, it might be better to use C arrays than to do strange things to std::arrays, even if it /would/ turn out to be possible. But in any case, whatever you do would be isolated in that class. /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o . |
Frederick Gotham <cauldwell.thomas@gmail.com>: Mar 19 05:13AM -0700 On Thursday, March 19, 2020 at 11:59:29 AM UTC, Bonita Montero wrote: > Why should someone do this ? > You could stick with pointers, iterators or a span. typedef boost::lockfree::spsc_queue< std::array< std::array<uint8_t,16u>, 4u >, boost::lockfree::capacity<g_buffer_size_for_cryptor_thread> > SPSC_for_CryptorThread; SPSC_for_CryptorThread g_spsc_t1, g_spsc_t2, g_spsc_t3; auto main(void) -> int { std::array<uint8_t,192u> segment; ... g_spsc_t1.push( a subset of segment ); } If you have a better idea, I'm all ears. I think I wanna keep to C++11 though because the more recent standards and going a bit mad. |
cdalten@gmail.com: Mar 19 05:18AM -0700 On Thursday, March 19, 2020 at 5:13:53 AM UTC-7, Frederick Gotham wrote: > g_spsc_t1.push( a subset of segment ); > } > If you have a better idea, I'm all ears. I think I wanna keep to C++11 though because the more recent standards and going a bit mad. Let me give you some more advice so that you aren't destined to be in IT support until the day that you die. Besides reading the book "Advanced Programming in the Unix Environment" by the late Dr. Stevens, you should also give boost a rest. Kind of like how girls tell you to give your right hand a rest if ya know what I mean Vern. |
Frederick Gotham <cauldwell.thomas@gmail.com>: Mar 19 05:22AM -0700 > Let me give you some more advice so that you aren't destined to be in IT support until the day that you die. Do you know what my day job is? |
cdalten@gmail.com: Mar 19 05:24AM -0700 On Thursday, March 19, 2020 at 5:22:11 AM UTC-7, Frederick Gotham wrote: > On Thursday, March 19, 2020 at 12:18:17 PM UTC, cda...@gmail.com wrote: > > Let me give you some more advice so that you aren't destined to be in IT support until the day that you die. > Do you know what my day job is? Well given the fact that you don't appear to be that well read, and like, pretty some pretty poor C++, I'm suspecting that you aren't a Software Engineer for a place like Google, Facebook, or Uber. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Mar 19 07:33PM On 19/03/2020 11:59, Bonita Montero wrote: >> } > Why should someone do this ? > You could stick with pointers, iterators or a span. using gtfo = std::array<std::array<char, 4> ,3>; void Func(gtfo& stopTrolling); :p /Flibble -- "Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Byrne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
Sam <sam@email-scan.com>: Mar 18 07:46PM -0400 Bonita Montero writes: > regulary in a project the effort sums up to a essential part of the > work. > However, no matter how complex the type is, it's just unecessary. Not only that, but it is not necessary to also use std::vector, std::list, or any other container in the C++ library. Same thing: none of them are necessary, and it is possible to do everything they do, by yourself. So, please stop using them in your code, because it will be quite unreadable, as a result. |
Sam <sam@email-scan.com>: Mar 18 07:47PM -0400 Ian Collins writes: >>> If you arguing against yourself there's nothing more to say. >> Here are your toys. You can go home now. > See what happens when you feed the troll? I'm still hungry. |
Bonita Montero <Bonita.Montero@gmail.com>: Mar 19 06:41AM +0100 > Not only that, but it is not necessary to also use std::vector, > std::list, or any other container in the C++ library. ... It doesn't depend on the type of container. It's usually not possible to guess the contained type. |
Sam <sam@email-scan.com>: Mar 19 07:02AM -0400 Bonita Montero writes: >> Not only that, but it is not necessary to also use std::vector, std::list, >> or any other container in the C++ library. ... > It doesn't depend on the type of container. Neither does auto. > It's usually not possible to guess the contained type. Someone who knows C++ does not need to guess. You're just not very good at C++. That's ok. C++ is very complicated. Not everyone can manage to learn it correctly. |
Bonita Montero <Bonita.Montero@gmail.com>: Mar 19 12:41PM +0100 >> It's usually not possible to guess the contained type. > Someone who knows C++ does not need to guess. You're just not very good > at C++. ... When you didn't write the code you usually have to check the type of the container. When you haven't looked at the code for a long time you might also. |
"Öö Tiib" <ootiib@hot.ee>: Mar 19 06:10AM -0700 On Thursday, 19 March 2020 13:41:55 UTC+2, Bonita Montero wrote: > When you didn't write the code you usually have to check the > type of the container. When you haven't looked at the code for > a long time you might also. If you know so well C++ then tell us how you conclude the type of container from following code: for (std::pair<std::string, int> e : container) { std::cout << e.first << ": " << e.second << '\n'; } It works with raw array of pairs, most of standard library containers and containers from libraries like boost that allow to have elements of type pair. So if container's type matters then you have to check it anyway to understand the code. |
Bonita Montero <Bonita.Montero@gmail.com>: Mar 19 02:15PM +0100 > for (std::pair<std::string, int> e : container) { > std::cout << e.first << ": " << e.second << '\n'; > } You don't need it to know in every caser , but at least you know the type of its entities; which you don't know with auto. |
Daniel <danielaparker@gmail.com>: Mar 19 08:24AM -0700 On Thursday, March 19, 2020 at 7:02:26 AM UTC-4, Sam wrote: > Bonita Montero writes: > > It's usually not possible to guess the contained type. > Someone who knows C++ does not need to guess. That's clearly wrong as, depending on the container, type deduction via auto is not always the right thing to do. One example is std::vector<bool>, or proxied containers generally. Daniel |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment