Perhaps I have misunderstood your question but
doesn't hex.EncodeToString(s1s2Byte) do what you want?

On Fri, Mar 10, 2023 at 7:33 AM Van Fury <furyva...@gmail.com> wrote:

> Hi,
>
> I have two hexadecimal string values and would like to concatenate the two
> strings and
>
>    1. encode the result to binary
>    2. decode the resulting binary back to hexadecimal string
>
> I did the following but I was finding it difficult to decode the result
> back. I ignore error check in this case.
>
> What i did so far:
>
> s1 := "1d28ed66824aa2593e1f2a4cf740343f"
>
> s2 := "dee2bd5dde763885944bc9d65419"
>
> s3 := s1 + s2
>
> s1s2Byte, _ := hex.DecodeString(s3)
>
> randAutnBin := fmt.Sprintf("%b", s1s2Byte)
>
> result:
>
> [11101 101000 11101101 1100110 10000010 1001010 10100010 1011001 111110
> 11111 101010 1001100 11110111 1000000 110100 111111 11011110 11100010
> 10111101 1011101 11011110 1110110 111000 10000101 10010100 1001011 11001001
> 11010110 1010100 11001]
>
> I would like to decode the binary result back the hexadecimal string to
> get s1 and s2.
>
> Any help?
>
> Van
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/ad3a981b-cf22-47cd-9fe6-8db83a097b42n%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/ad3a981b-cf22-47cd-9fe6-8db83a097b42n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD-vLFhw6U2PDx%2BQzy%3DvXCGR6ThpLQehCN3JysQE26R00Q%40mail.gmail.com.

Reply via email to