Skip to main content
added 162 characters in body
Source Link
Maarten Bodewes
  • 94.5k
  • 13
  • 165
  • 319

Let us consider a simple string in Hex: 2E Its SHA value is:

cdb4ee2aea69cc6a83331bbe96dc2caa9a299d21329efb0336fc02a82e1839a8

Yes, that's correct.

When converted into byte form should we write 46 or 046.

Neither.

The whole idea of using hexadecimals for bytes is to represent the value of the bytes. So 2E is the hexadecimal representation of a single byte. You can also use other representations such as 00101110 in binary.

If you interpret it as ASCII text it would be the "dot" character. So printf "\x2E" | sha256sum is the same as printf "." | sha256sum on most systems. So on your site you could simply use a single dot as text. It's also possible to do this using echo but echo has too many portability issues to be considered a reliable alternative to printf.

Generally we don't represent bytes using decimals. If you do you'll probably have to program it specifically. For instance in Java you could use byte b = 46 or byte[] ba = { 46 } and then use that in a hash algorithm. If you really want to program it using command line then printf "\\x$(printf "%x" 46)" | sha256sum seems to work.

Let us consider a simple string in Hex: 2E Its SHA value is:

cdb4ee2aea69cc6a83331bbe96dc2caa9a299d21329efb0336fc02a82e1839a8

Yes, that's correct.

When converted into byte form should we write 46 or 046.

Neither.

The whole idea of using hexadecimals for bytes is to represent the value of the bytes. So 2E is the hexadecimal representation of a single byte. You can also use other representations such as 00101110 in binary.

If you interpret it as ASCII text it would be the "dot" character. So printf "\x2E" | sha256sum is the same as printf "." | sha256sum on most systems. So on your site you could simply use a single dot as text.

Generally we don't represent bytes using decimals. If you do you'll probably have to program it specifically. For instance in Java you could use byte b = 46 or byte[] ba = { 46 } and then use that in a hash algorithm.

Let us consider a simple string in Hex: 2E Its SHA value is:

cdb4ee2aea69cc6a83331bbe96dc2caa9a299d21329efb0336fc02a82e1839a8

Yes, that's correct.

When converted into byte form should we write 46 or 046.

Neither.

The whole idea of using hexadecimals for bytes is to represent the value of the bytes. So 2E is the hexadecimal representation of a single byte. You can also use other representations such as 00101110 in binary.

If you interpret it as ASCII text it would be the "dot" character. So printf "\x2E" | sha256sum is the same as printf "." | sha256sum on most systems. So on your site you could simply use a single dot as text. It's also possible to do this using echo but echo has too many portability issues to be considered a reliable alternative to printf.

Generally we don't represent bytes using decimals. If you do you'll probably have to program it specifically. For instance in Java you could use byte b = 46 or byte[] ba = { 46 } and then use that in a hash algorithm. If you really want to program it using command line then printf "\\x$(printf "%x" 46)" | sha256sum seems to work.

not all echo's process backslash escapes by default, and \2e isn't a valid one anyway. printf is more portable
Source Link

Let us consider a simple string in Hex: 2E Its SHA value is:

cdb4ee2aea69cc6a83331bbe96dc2caa9a299d21329efb0336fc02a82e1839a8

Yes, that's correct.

When converted into byte form should we write 46 or 046.

Neither.

The whole idea of using hexadecimals for bytes is to represent the value of the bytes. So 2E is the hexadecimal representation of a single byte. You can also use other representations such as 00101110 in binary.

If you interpret it as ASCII text it would be the "dot" character. So echo -nprintf "\2E""\x2E" | sha256sum is the same as echo -nprintf "." | sha256sum on most systems. So on your site you could simply use a single dot as text.

Generally we don't represent bytes using decimals. If you do you'll probably have to program it specifically. For instance in Java you could use byte b = 46 or byte[] ba = { 46 } and then use that in a hash algorithm.

Let us consider a simple string in Hex: 2E Its SHA value is:

cdb4ee2aea69cc6a83331bbe96dc2caa9a299d21329efb0336fc02a82e1839a8

Yes, that's correct.

When converted into byte form should we write 46 or 046.

Neither.

The whole idea of using hexadecimals for bytes is to represent the value of the bytes. So 2E is the hexadecimal representation of a single byte. You can also use other representations such as 00101110 in binary.

If you interpret it as ASCII text it would be the "dot" character. So echo -n "\2E" | sha256sum is the same as echo -n "." | sha256sum on most systems. So on your site you could simply use a single dot as text.

Generally we don't represent bytes using decimals. If you do you'll probably have to program it specifically. For instance in Java you could use byte b = 46 or byte[] ba = { 46 } and then use that in a hash algorithm.

Let us consider a simple string in Hex: 2E Its SHA value is:

cdb4ee2aea69cc6a83331bbe96dc2caa9a299d21329efb0336fc02a82e1839a8

Yes, that's correct.

When converted into byte form should we write 46 or 046.

Neither.

The whole idea of using hexadecimals for bytes is to represent the value of the bytes. So 2E is the hexadecimal representation of a single byte. You can also use other representations such as 00101110 in binary.

If you interpret it as ASCII text it would be the "dot" character. So printf "\x2E" | sha256sum is the same as printf "." | sha256sum on most systems. So on your site you could simply use a single dot as text.

Generally we don't represent bytes using decimals. If you do you'll probably have to program it specifically. For instance in Java you could use byte b = 46 or byte[] ba = { 46 } and then use that in a hash algorithm.

added 59 characters in body
Source Link
Maarten Bodewes
  • 94.5k
  • 13
  • 165
  • 319

Let us consider a simple string in Hex: 2E Its SHA value is:

cdb4ee2aea69cc6a83331bbe96dc2caa9a299d21329efb0336fc02a82e1839a8

Yes, that's correct.

When converted into byte form should we write 46 or 046.

Neither.

The whole idea of using hexadecimals for bytes is to represent the value of the bytes. So 2E is the hexadecimal representation of a single byte. You can also use other representations such as 00101110 in binary.

If you interpret it as ASCII text it would be the "dot" character. So echo -n "\2E" | sha256sum is the same as echo -n "." | sha256sum on most systems. So on your site you could simply use a single dot as text.

Generally we don't represent bytes using decimals. If you do you'll probably have to program it specifically. For instance in Java you could use byte b = 46 or byte[] ba = { 46 } and then use that in a hash algorithm.

Let us consider a simple string in Hex: 2E Its SHA value is:

cdb4ee2aea69cc6a83331bbe96dc2caa9a299d21329efb0336fc02a82e1839a8

Yes, that's correct.

When converted into byte form should we write 46 or 046.

Neither.

The whole idea of using hexadecimals for bytes is to represent the value of the bytes. So 2E is the hexadecimal representation of a single byte. You can also use other representations such as 00101110 in binary.

If you interpret it as ASCII text it would be the "dot" character. So echo -n "\2E" | sha256sum is the same as echo -n "." | sha256sum on most systems.

Generally we don't represent bytes using decimals. If you do you'll probably have to program it specifically. For instance in Java you could use byte b = 46 or byte[] ba = { 46 } and then use that in a hash algorithm.

Let us consider a simple string in Hex: 2E Its SHA value is:

cdb4ee2aea69cc6a83331bbe96dc2caa9a299d21329efb0336fc02a82e1839a8

Yes, that's correct.

When converted into byte form should we write 46 or 046.

Neither.

The whole idea of using hexadecimals for bytes is to represent the value of the bytes. So 2E is the hexadecimal representation of a single byte. You can also use other representations such as 00101110 in binary.

If you interpret it as ASCII text it would be the "dot" character. So echo -n "\2E" | sha256sum is the same as echo -n "." | sha256sum on most systems. So on your site you could simply use a single dot as text.

Generally we don't represent bytes using decimals. If you do you'll probably have to program it specifically. For instance in Java you could use byte b = 46 or byte[] ba = { 46 } and then use that in a hash algorithm.

Source Link
Maarten Bodewes
  • 94.5k
  • 13
  • 165
  • 319
Loading