I have two hexadecimal string values and would like to concatenate the two strings and
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...@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.
--
Sorry I did not frame my question properly but what I would like to do is toencode concatenated s1 and s2 into raw binary and then decode the raw binaryback to s1 and s2.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/1f66ccdc-6c58-48f0-9017-9614220f88d9n%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/wCGYXo-r-uo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/8c1be24c-8056-4b74-ac79-e1f8ae7bf935n%40googlegroups.com.
Relating to my previous question, I have been reading but it is still not clear to me what raw binary is, how is it different fromtext formatted binary (fmt.Sprintf("%b", s1s2Byte))?In my problem above I need to encode s1+s2 to raw binary before sending the result to the serverwhich then decodes the raw binary back to s1+s2.
--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD_oDA%3DEB4My7NJ0W_%3D0UtTTJeDeGqRotiK%3DSTKTRv4Cxw%40mail.gmail.com.
Relating to my previous question, I have been reading but it is still not clear to me what raw binary is, how is it different fromtext formatted binary (fmt.Sprintf("%b", s1s2Byte))?
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/5cd8a906-5b73-4b86-abb1-8106fd9f73cdn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/3bf5ccfd-e007-4f8c-8d1e-a6e76800c403n%40googlegroups.com.
Am developing a server (diameter) which will response with an AVP SIP-Authenticate. In the specification" The SIP-Authenticate AVP is of type OctetString and It shall contain, binary encoded, the concatenation of the authentication challenge RAND and the token AUTN"
The RAND and the AUTN in this case are hexadecimal strings s1 and s2.
Am developing a server (diameter) which will response with an AVP SIP-Authenticate. In the specification" The SIP-Authenticate AVP is of type OctetString and It shall contain, binary encoded, the concatenation of the authentication challenge RAND and the token AUTN"The RAND and the AUTN in this case are hexadecimal strings s1 and s2.My problem is how to encode s1 and s2 concatenated and then be able to decode at the server side too.