BinaryByter
Anonymous
Nicola
I have the string s, and I copy this string in string t, after I realized the shuffle and I saved the index in k ..... How can I get the original string s?
[I only have the shuffled string and the position indexes]
Anonymous
If you randomly shuffle the bits without saving the original information/original position of your bits, there is no way to get the information back.
if you are interested in cryptography to gain back the obfuscated information, there are systems were this is possible. but it is not possible when you do this without a system and rely on fortune
Ludovic 'Archivist'
Ludovic 'Archivist'
Nicola
Dima
Manish
How can i solve "double free or curruption (out) " error.
Nicola
Anonymous
@BurningTiles : you assign a nullptr to your pointer and check the pointer for nullptr before doing a free/delete on this pointer?
Anonymous
@nikola: then you have all the information. the k array is your "compressed" original. just put the 1 or 0 (depending on the logic you use) to the saved positions of an empty data type. then you have your orignal back
Nicola
Anonymous
Do you mean, you save the destination position but not the source position?
Manish
Nicola
No the source position
Manish
Anonymous
if you save the source position, then you have all information you need to restore the original information
Nicola
the element s[0] will be t [ traded position] and I saved this position in the k array
klimi
teach me how to program
klimi
ty
Anonymous
rtfm :)
klimi
what manual? just to be clear
Nicola
https://pastebin.com/yRGUnHcR
Nicola
Anonymous
Nicola
V
Oh guys, a few minutes ago I've seen the book's Stroustrup "A Tour of C++" here. Is it good book as re-learning material? I mean when you already had some practice and read some books and you something know yet and you just wanna remind yourself some aspects
BinaryByter
BinaryByter
read that!!
Anonymous
absolutely, read that one
V
Thanks for answers :3
Anonymous
np. andrei alexandrescu, scott meyers and herb sutter have also written some damn good books, if you want to dive deeper into cpp
klimi
klimi
#cppbook
V
Anonymous
effective c++ by scott meyers is a bit "outdated" but still damn good to get a better understanding for c++. it is a nice read and you have plenty of examples you can try out by yourself
V
Yeah, it is, thanks
klimi
V
Anonymous
Have a good read. I was lucky to meet this guy twice in person before he retired.
Nicola
Is there a function that performs random exchange within the vector?
Anonymous
shuffle() or the deprecated random_shuffle(). I thought we had this discussed yesterday, haven't we?
Nicola
Nicola
or I can use it only for vector <int>
Anonymous
you can use this on any datastructure, you habe to state the begin and ending of the data structure you want to shuffle
Nicola
therefore v [10] = {0,1,2,3,4,5,6,7,8,9};
random_shuffle(v[0], v[9]);
BinaryByter
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7af7cba in std::local_Rb_tree_decrement (
__x=0x64c9e8 <WCP::ENV::UTIL::COOKIE_MAP[abi:cxx11]+8>)
at ../../../../../libstdc++-v3/src/c++98/tree.cc:98
98 ../../../../../libstdc++-v3/src/c++98/tree.cc: No such file or directory.
(gdb) bt
#0 0x00007ffff7af7cba in std::local_Rb_tree_decrement (
__x=0x64c9e8 <WCP::ENV::UTIL::COOKIE_MAP[abi:cxx11]+8>)
at ../../../../../libstdc++-v3/src/c++98/tree.cc:98
#1 0x0000000000431a0a in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_get_insert_unique_pos(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
#2 0x000000000042f813 in std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_emplace_hint_unique<std::piecewise_construct_t const&, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>, std::tuple<> >(std::_Rb_tree_const_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::piecewise_construct_t const&, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>&&, std::tuple<>&&) [clone .isra.119] ()
#3 0x000000000042fc5d in WCP::ENV::COOKIE(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) ()
#4 0x0000000000404539 in USER::isUserLoggedIn() ()
---Type <return> to continue, or q <return> to quit---
#5 0x0000000000404d66 in __static_initialization_and_destruction_0(int, int) ()
#6 0x0000000000404fd4 in _GLOBAL__sub_I__ZN4USER14isSessionValidEv ()
#7 0x0000000000437d1d in __libc_csu_init ()
#8 0x00007ffff7158f7b in __libc_start_main () from /lib64/libc.so.6
#9 0x00000000004042fa in _start ()
(gdb) q
A debugging session is active.
BinaryByter
does anybody have a clue why the fuck I get this error on operator[] of std::map?
Anonymous
Maybe you overrun the map somewhere
Anonymous
Looks like it
BinaryByter
"overrun"?
Anonymous
segmentation fault, you access memory that your application did not reserve for it
BinaryByter
except I didnt write that code
Anonymous
Yeah, [] is not safe against out-of-bounds overruns
BinaryByter
what are "overruns"?
Anonymous
check your buffers and how you access them
Anonymous
A bufferoverflow
BinaryByter
oh okay
Anonymous
for example
BinaryByter
wait map has a buffer which I need to size correctly?
BinaryByter
BinaryByter
what do you mean "[] is not safe against out-of-bounds overruns"?
BinaryByter
what do you mean by "overrun"?
Anonymous
nvm, mentally I thought for some reason you're talking about vector lel
BinaryByter
lol no
BinaryByter
xD
Anonymous
I really should sleep when I'm under drugs
BinaryByter
yes ;)
Anonymous
lol no
Yeee, well, most people how use vector and has some weird segfault it's cause of the use of []^^ But yeah I don't really feel fit
BinaryByter
xDD
BinaryByter
But like... what could be causing my problem?
klimi
BinaryByter
No
BinaryByter
you are nice
Anonymous
I dunno, I think I'm not a great help today 😆Sorry
BinaryByter
Don't worry, shelly
Anonymous
Okay thanks c:
BinaryByter
xD