Skip to content

.net Deflate / nodejs Deflate Output does not match with golang flate module with level 9 #39095

@sudeepigntion

Description

@sudeepigntion

// Golang Sample

  var deflated_data bytes.Buffer
  fl, err := flate.NewWriter(&deflated_data, 9)

if err != nil{

	return nil, errors.New(err.Error())

}

if _, err := fl.Write([]byte("63=FIX3.0|64=127|65=80|4=1000|1=3|7=523630|230=1")); err != nil{
    
	return nil, errors.New(err.Error())

}

if err := fl.Close(); err != nil {
    
    return nil, errors.New(err.Error())

}

    log.Println(deflated_data.Bytes())

// sample output
[4 192 193 13 128 48 20 2 208 141 12 124 90 234 133 171 137 27 56 12 195 251 172 60 239 167 11 245 10 231 212 59 55 186 66 0 101 212 147 61 178 208 17 194 63 0 0 255 255]

.net Sample Code

      private static byte[] Compress(Stream input)
     {
          using(var compressStream = new MemoryStream())
          using(var compressor = new DeflateStream(compressStream, 9))
         {
             input.CopyTo(compressor);
             compressor.Close();
             return compressStream.ToArray();
         }
   }

    Compress("63=FIX3.0|64=127|65=80|4=1000|1=3|7=523630|230=1")

// sample output
13,198,177,13,0,32,12,3,176,143,80,218,64,97,201,138,196,7,28,147,227,193,147,139,218,231,178,193,213,21,57,93,67,11,254,7,224,16,61,53,146,69,56,9,197,3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions