Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to add the binary of a int with the binary of a string
    text
    copied!<p>Basically i want to be able to get a 32bit int and attach its binary to the binary of a string. E.g. (IM going to use 8bit instead of 32bit) i want 255 + hi 11111111 + 0110100001101001 = 111111110110100001101001 So the int holds its binary value,i dont care how it comes out i just want it to be able to send the data over a socket.</p> <p>(This is all over websockets and the new sec-websocket-key's to stop hacking, if anyone just knows how to do the websocket handshake that would be just as nice)</p> <p>Thankyou ! I have been trying on this for days and im not one to come to this type of website to get the answer</p> <h2>EDIT</h2> <p>Ive been ask to give more info so her is the full deal. I have connected to the user of a stream port, he has sent me headers now i need to reply to to complete the connection. The import data is</p> <p>Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5"Random string following rules"(i will call this sk1)</p> <p>Sec-WebSocket-Key2: 12998 5 Y3 1 .P00 "Random string following rules"(i will call this sk2)</p> <p>^n:ds[4U "Random string following rules"(i will call this sk3)</p> <p>1) int1 = compress the numbers into sk1 and divid them by the amount of spaces in sk1</p> <p>2) int2 = compress the numbers into sk2 and divid them by the amount of spaces in sk2</p> <p>3) fullapend = Add append the bytes of int2 to int1 then append the bytes in sk3</p> <p>4) Finally MD5 digest fullapend</p> <p>5) Send the final result to the host along with some other headers and if they match up the connection holds open</p> <p>That is everything that needs to happen and i have not got a clue how to do it</p> <h2>Finished !</h2> <p>Well basic both answers was right and i would like to apologise if i seemed a bit rude, i didnt know the \x was a (something) meaning binary. but that worked a treat. Once i have the finished function to connect send etc... i will post it on here and else where for anyone else thats stuck, again thankyou !</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload