Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1086355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:48:10+00:00 2026-05-16T22:48:10+00:00

Basically i want to be able to get a 32bit int and attach its

  • 0

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.

(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)

Thankyou ! I have been trying on this for days and im not one to come to this type of website to get the answer

EDIT

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

Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5″Random string following rules”(i will call this sk1)

Sec-WebSocket-Key2: 12998 5 Y3 1 .P00 “Random string following rules”(i will call this sk2)

^n:ds[4U “Random string following rules”(i will call this sk3)

1) int1 = compress the numbers into sk1 and divid them by the amount of spaces in sk1

2) int2 = compress the numbers into sk2 and divid them by the amount of spaces in sk2

3) fullapend = Add append the bytes of int2 to int1 then append the bytes in sk3

4) Finally MD5 digest fullapend

5) Send the final result to the host along with some other headers and if they match up the connection holds open

That is everything that needs to happen and i have not got a clue how to do it

Finished !

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 !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T22:48:10+00:00Added an answer on May 16, 2026 at 10:48 pm

    Is this what you’re looking for? Don’t know whether you’re after a hexdigest or a digest, and I couldn’t tell where the keys started and stopped, which is a shame as they are whitespace sensitive.

    Also in your update you said “compress” numbers when I think you meant “concatenate”. I think the resulting keys are supposed to be bigendian, which is what I’ve done.

    >>> import struct
    >>> def processKey(data):
    ...     num = int("".join([x for x in data if x.isdigit()]))
    ...     spaces = data.count(' ')
    ...     return num / spaces
    ...
    >>> key1 = '4 @1 46546xW%0l 1 5'
    >>> key2 = '12998 5 Y3 1 .P00 '
    >>> sk1 = processKey(key1)
    >>> sk2 = processKey(key2)
    >>> sk1
    1036636503L
    >>> sk2
    259970620
    >>> sk3 = "^n:ds[4U"
    >>> fullappend = struct.pack('>ii%ds' % len(sk3),sk1,sk2,sk3)
    >>> fullappend
    '=\xc9\xd1W\x0f~\xd6<^n:ds[4U'
    >>> len(fullappend)
    16
    >>> from hashlib import md5
    >>> md5(fullappend).hexdigest()
    'fd028b6b39ceb8e37f09b8e45556bbc4'
    >>> md5(fullappend).digest()
    '\xfd\x02\x8bk9\xce\xb8\xe3\x7f\t\xb8\xe4UV\xbb\xc4'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically we want to be able to somehow synchronize our .NET application's contacts with
Okay, so basically I want to be able to retrieve keyboard text. Like entering
Basically, what I want to is be able to explore an ActiveX DLL. I
I basically want to use link_to to link to the index method of a
Basically I want to pass a string which contains Spanish text that could be
How to use onclick in iframe tag to call a javascript. I basically want
I basically want to do this: grep 'example.com' www_log > example.com.YYYY-MM-DD-H:i:S.log ...with of course
So I basically want to have a static method in my AR class to
I have a 2-dimensional array of objects and I basically want to databind each
This is an incredibly simple question (I'm new to Python). I basically want a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.