Difference between String Value and Binary Value in Registry - windows

Can someone explain me when to use String Value or Binary Value in windows registry? Is there any security concerns also attached with these or not ?

I want to store date in encrypted format
You must use the binary format. Encrypted data cannot be stored in a string. It will randomly get corrupted when the string is normalized, not every byte value is a valid Unicode codepoint. If you absolutely want a string then you have to encode the data, Convert.ToBase64String().

Related

How does GitHub encode their graphQL cursors?

GitHub's graphql cursors are intentionally opaque, so they shouldn't ever be decode by a client. However I'd like to know their approach towards pagination, especially when combined with sorting.
There are multiple layers of encoding for the encoding used for pagination cursors used by GitHub. I will list them in order from the perspective of a decoder:
The cursor string is encoded using URL safe base64 meaning it uses - and _ instead of + and /. This might be to have consistency with their REST based API.
Decoding the base64 string gives us another string in the format of cursor:v2:[something] so the next step is decoding the something.
The 'something' is a binary encoded piece of data containing the actual cursor properties. The first byte defines the cursor type:
0x91 => We don't use any sorting, the cursor contains the length of the id field and the id itself. 0xcd seems to indicate a two-byte id, 0xce a four-byte id. This is followed by the id itself, which can be verified by decoding the base64 id graphql field.
0x92 => A composite cursor containing the sorted property and the id. This is either a length-prefixed ordinal number or two bytes plus a string or ISO date string followed by the length-prefixed id.

How to decode base64 & hexadecimal response from query

The query comes as
"returnData": [
"zWCLtKpUXZbkWNM9deAVPizTxXASOjX63ubdUHDN+vw=",
"zWCLtKpUXZbkWNM9deAVPizTxXASOjX63ubdUHDN+vw="
],
How can I decode that string? I can see it is decodable base64 first, but I get a very weird string after. Can someone show me the steps to follow to receive the decoded final string?
Base64 encodes binary data, which means if you send data that is not a string you won't be able to retrieve a string back. So to properly parse the return data you will need to know what data types were actually returned.
It might also be helpful to use a base64 to hex decoder first, so you get the hex representation of your data.
To give you more concrete recommendations we would need to know what data you expected, preferably showing the whole endpoint definition as well as any custom structs that might be involved.

how to decode an hexacidemal values to binary ones with springboot?

i am a new developper
i don't know how to decode hexacidemal values to binary ones with springboot, Is There a default functions That can help me or should i develop functions by myself
Also ,i want to compare the result with another one , should the 2 values be String ?
thank You
When you group 4 bits(1 bit is binary) it form a tuple which represent by one Hex decimal number.
There is no need of converting Hex to binary(in string format).
If you still want to do this you can refer:
https://www.geeksforgeeks.org/java-program-to-convert-hexadecimal-to-binary/

Generate unique alpha-numeric object ID, like Parse

I already asked what I needed at the title. I want to generate using either PHP or javascript.
I think the class name and some properties are used to build the objectId but someone may already know how its done that could share here?
The Parse Server generates the objectId. It is a randomly generated String of 10 chars length. You can see their implementation at cryptoUtils.newObjectId(). From the code we can conclude that they are not enforcing uniqueness.
https://github.com/ParsePlatform/parse-server/blob/master/src/cryptoUtils.js
Parse is probably using ids generated in Mongodb. They are not random and can be potentially predicted :
A BSON ObjectID is a 12-byte value
consisting of a 4-byte timestamp
(seconds since epoch), a 3-byte
machine id, a 2-byte process id, and a
3-byte counter
http://www.mongodb.org/display/DOCS/Object+IDs

Make UUID shorter (Hex to ASCII conversion)

In my web application one model uses identifier that was generated by some UUID tool. As I want that identifier to be part of the URL I am investigating methods to shorten that UUID string. As it is currently is in hexadecimal format I thought about converting it to ASCII somehow. As it should afterwards only contain normal characters and number ([\d\w]+) the normal hex to ASCII conversion doesn't seem to work (ugly characters).
Do you know of some nice algorithm or tool (Ruby) to do that?
A UUID is a 128-bit binary number, in the end. If you represent it as 16 unencoded bytes, there's no way to avoid "ugly characters". What you probably want to do is decode it from hex and then encode it using base64. Note that base64 encoding uses the characters + / = as well as A-Za-z0-9, you'll want to do a little postprocessing (I suggest s/+/-/g; s/\//_/g; s/==$// -- a base64ed UUID will always end with two equals signs)

Resources