1

I need to decompress hex values and convert those to string.

Actual problem is that i'm not able to figure out how to decompress hex values

Hex do not contain any headers, If i copy hex codes to CyberChef i'm able to decompress those and have original string

In CyberChef only Raw Inflate operation is needed So i'm hoping help how to do raw inflate in R

I have tried memDecompress using all options without success (i.e gzip etc)

UPDATE: Here is a sample from hex: e3 0e 71 0d 0e f1 54 c8 cb 2f 52 30 02 00 which i'm able to convert using CyberChef to string ".TESTI nor 2"

RLdata<- sqlQuery(connection, ..... AS Varbinary(max) AS NOTEShort ......

> RLdata$NOTEshort[4268]
[[1]]
 [1] e3 0e 71 0d 0e f1 54 c8 cb 2f 52 30 02 00

> unlist(RLdata$NOTEshort[4268])
 [1] e3 0e 71 0d 0e f1 54 c8 cb 2f 52 30 02 00
> memDecompress(unlist(RLdata$NOTEshort[4268]),type = "gzip", asChar = TRUE)
Error in memDecompress(unlist(RLdata$NOTEshort[4268]), type = "gzip",  : 
  internal error -3 in memDecompress(2)

> memDecompress(unlist(RLdata$NOTEshort[4268]),type = "unknown", asChar = TRUE)
[1] "ã\016q\r\016ñTÈË/R0\002"
Warning message:
In memDecompress(unlist(RLdata$NOTEshort[4268]), type = "unknown",  :
  unknown compression, assuming none

screenshot from CyberChef (png)

2 Answers2

0

If you convert it into Base64 and then decode it back to Hex I think it decompresses to original, but may have been changed by a bug fix. It used to do this a couple of years back but I haven't used CyberChef in a while, sorry

-1

Had to do this using python3. Zlib.decompress() did the trick.

Link to python solution Read Dynamics NAV Table Metadata with SQL