[Solved] Can you someone explain to me this code? [closed]

22, in binary 0000000000010110 225, in binary 0000000011100001 222, in binary 0000000011011110 | is binary OR operator: The binary OR operation has two inputs and one output. It is like the ADD operation which takes two arguments (two inputs) and produces one result (one output). A B C 0 OR 0 -> 0 0 OR … Read more

[Solved] How many bytes does this String have?

Without context, it’s just hard to understand your question. The last 3 bytes of the hash “742da831d2b657fa53d347301ec610e1ebf8a3d0” you give are “f8a3d0”, which are the last 6 characters “F8A3D0” in “SpeedTouchF8A3D0”. The first 5 bytes of the hash “742da831d2b657fa53d347301ec610e1ebf8a3d0” are “742da831d2”, which gives the 10-character string you are referring to: “742DA831D2”. 1 solved How many bytes … Read more

[Solved] This c# code displays the first letter decimal value of a string only…e.g the output is ..101.. when it should display … 101 032 057 097 065 [closed]

Declare a string value and append to it on each iteration, then set the textbox.text property value. using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; using System.IO; namespace encrypto { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } void OnClick(object sender, EventArgs e) { string Plaintext = textBox1.Text; string byteText = … Read more

[Solved] Please help me with pascal to c# code conversion [closed]

Existing Delphi code translation: public static string ByteToHex(Byte InByte) { char[] Digits = new char[] { ‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’, ‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, }; return string.Concat(Digits[InByte >> 4], Digits[InByte & 0x0F]); } Better implementation (all you want is formatting): public static string ByteToHex(Byte InByte) => InByte.ToString(“X2”); … Read more

[Solved] Convert file of bytes to ints Python [duplicate]

You might want to read Read ints from file in python It is even more straightforward from that question. I have not checked the following code but something along the spirit of fin = open(“hi.bmp”, “rb”) out = open(“values.txt”,”rw”) value = struct.unpack(‘i’, fin.read(4))[0] out.write(“%d\n” % value) # just loop over the 2 last lines out.close() … Read more

[Solved] C++ How can i build byte arrays?

In C and C++, regular character strings are terminated by a ‘\0’ character. So it appears you are using a string function to copy the data. That is, it stops copying once it hits the ‘\0’ value. Interestingly, you left the part that copies the data (and maybe just the part the displays the data) … Read more

[Solved] How to change a char to ASCII form?

Buff_Y[2] = (Y / 100) + 0x30; Buff_Y[1] = (Y / 10) % 10+0x30; Buff_Y[0] = (Y % 10) + 0x30; This is all good. If you print those three bytes, you will see that they contain the right values. SBUF = *Buff_Y; This, however, indicates confusion. *Buff_Y is equivalent to Buff_Y[0]. That is a … Read more

[Solved] What is the encoding of Java byte type?

Bytes don’t have an encoding. They’re bytes. See the Javadoc of String.getBytes(): Encodes this String into a sequence of bytes using the platform’s default charset So, it’s whatever your default charset is. You can find out what that is at runtime using Charset.defaultCharset(). If you want the bytes in a particular charset, specify it, e.g.: … Read more

[Solved] Combining string and []byte for payload

Here’s an example using multipart request. I modified this from a piece of code I have that deals with JSON docs, so there may be some mistakes in it, but it should give you the idea: body := bytes.Buffer{} writer := multipart.NewWriter(&body) hdr := textproto.MIMEHeader{} hdr.Set(“Content-Type”, “text/plain”) part, _ := writer.CreatePart(hdr) part.Write(data1) hdr = textproto.MIMEHeader{} … Read more

[Solved] How to find the n’th byte in a file [closed]

One solution in your case (unless you have strict restriction on space usage) would be to copy your file into another skipping bytes that you do not need. Depends on how you count nth byte you may need to open files in binary mode. You may rename source file to temp open new file with … Read more