divan / txqr-reader

TXQR (Animated QR data transfer) demo reader app for iOS
97 stars 18 forks source link

illegal base64 data at input byte 13 #8

Open fantasyding opened 2 years ago

fantasyding commented 2 years ago

I generated a gif with txqr-gif and then scanned with this demo, I had a problem some as #4, I followed his advice and solved it, now I can scan the gif. But after the scan is complete, the data is empty, I print the returned str, it contains illegal base64 characters,then base64 decode fails.How to solve it?

The error occurred lines: let str = decoder?.data() let data = Data(base64Encoded: str!)

sheng-di commented 2 years ago

Same question, my output is as following:

iVBiY`Dc\u{11}\u{1B}\u{0B}yWcqxms\u{18}T\u{0C}a\u{12}`*T\u{1F}+\'LaBt\u{05}XGe\00\"\u{1B}\u{0C}%J\u{06}Z~\u{0C}ra+D\u{0E}5\u{7F}$GcnM9\u{1B}Fq\rr5\u{04}\u{03}O\u{19}VUJ8Bm\u{7F}^RT5a`r\'\u{7F}p;{5T.yR\u{06}q]TAdTAAAOpgAAA6mAAAF3CculE8AAAAhGVYSWZNTQAqAAAACAAFARIAgIDr\u{02}g2\"j\t\r\"\u{18}>\u{04}@\u{1B}-l\u{17}\rrOY=\u{04}\u{0C}\u{0E}\u{1A}\u{7F}\u{10}g}y\u{01}]{9\u{0C}a\"\u{07}\u{08}1j<gAAQJ&Xi7^\u{0B}2(3:%\\\u{12}MT,Dp/D}\u{0B}\u{0E}\u{07}\u{1D}Y:j?>Pz\u{10}8\'p;r\u{05}(\u{19}\u{0B}v\u{18}cb`G0t-%nAzqo\'\u{18}*i<\u{11} 5sY\u{06}?k\u{04}yvvxH/C\u{13}N\"Ce4\u{07}\'\u{1A}{SS?2^jAABAA-6hgXl\u{1D}\u{10}\u{04}ig\u{0B}k\u{01}z\u{19}\u{0F}O+\u{0B}&$\u{11}n\u{13}\u{1D}J(VP\u{16}C\u{0C}!ONDc@P\u{03}\u{06}S\u{0E} UT\u{05}K9hn\u{06}\u{17}NP,?KfTI`\u{0C}S^(qBtg\u{05})Se \u{06}Q\u{04}\u{1F}da\u{13}\u{0F}XLbY\r\u{14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mCC
fantasyding commented 2 years ago

i solved it like this: edit encode.go in txqr project

func (e *Encoder) frame(blockCode int64, total int, data []byte) string {
    return fmt.Sprintf("%d/%d/%d|%s", blockCode, e.chunkLen, total, base64.StdEncoding.EncodeToString(data))
}

And edit decode.go in Decodemethod

    func (d *Decoder) Decode(chunk string) error {
    idx := strings.IndexByte(chunk, '|') // expected to be validated before
    if idx == -1 {
        return fmt.Errorf("invalid frame: \"%s\"", chunk)
    }

    header := chunk[:idx]
    // continuous QR reading often sends the same chunk in a row, skip it
    if d.isCached(header) {
        return nil
    }

    var (
        blockCode       int64
        chunkLen, total int
    )
    _, err := fmt.Sscanf(header, "%d/%d/%d", &blockCode, &chunkLen, &total)
    if err != nil {
        return fmt.Errorf("invalid header: %v (%s)", err, header)
    }

    payload := chunk[idx+1:]
    data, err := base64.StdEncoding.DecodeString(payload)
    if err != nil {
        return fmt.Errorf("invalid base64 symbol: %v (%s)", err, payload)
    }
    lubyBlock := fountain.LTBlock{
        BlockCode: blockCode,
        Data:      data,
    }

    if d.fd == nil {
        d.total = total
        d.chunkLen = chunkLen
        numChunks := numberOfChunks(d.total, d.chunkLen)
        d.codec = fountain.NewLubyCodec(numChunks, rand.New(fountain.NewMersenneTwister(200)), solitonDistribution(numChunks))
        d.fd = d.codec.NewDecoder(total)
    }
    d.completed = d.fd.AddBlocks([]fountain.LTBlock{lubyBlock})

    return nil
}

I guess the cause of this problem is luby codec , so I base64 encode again after luby codec encode.

I hope this helps you.

sheng-di commented 2 years ago

Your code solved my problem, thanks.

However, this foutain code version lacks for a user-friendly progress info, so it's hard to knowo how long it will take.

Do you have any idea on this?

sheng-di commented 2 years ago

i solved it like this: edit encode.go in txqr project

func (e *Encoder) frame(blockCode int64, total int, data []byte) string {
  return fmt.Sprintf("%d/%d/%d|%s", blockCode, e.chunkLen, total, base64.StdEncoding.EncodeToString(data))
}

And edit decode.go in Decodemethod

  func (d *Decoder) Decode(chunk string) error {
  idx := strings.IndexByte(chunk, '|') // expected to be validated before
  if idx == -1 {
      return fmt.Errorf("invalid frame: \"%s\"", chunk)
  }

  header := chunk[:idx]
  // continuous QR reading often sends the same chunk in a row, skip it
  if d.isCached(header) {
      return nil
  }

  var (
      blockCode       int64
      chunkLen, total int
  )
  _, err := fmt.Sscanf(header, "%d/%d/%d", &blockCode, &chunkLen, &total)
  if err != nil {
      return fmt.Errorf("invalid header: %v (%s)", err, header)
  }

  payload := chunk[idx+1:]
  data, err := base64.StdEncoding.DecodeString(payload)
  if err != nil {
      return fmt.Errorf("invalid base64 symbol: %v (%s)", err, payload)
  }
  lubyBlock := fountain.LTBlock{
      BlockCode: blockCode,
      Data:      data,
  }

  if d.fd == nil {
      d.total = total
      d.chunkLen = chunkLen
      numChunks := numberOfChunks(d.total, d.chunkLen)
      d.codec = fountain.NewLubyCodec(numChunks, rand.New(fountain.NewMersenneTwister(200)), solitonDistribution(numChunks))
      d.fd = d.codec.NewDecoder(total)
  }
  d.completed = d.fd.AddBlocks([]fountain.LTBlock{lubyBlock})

  return nil
}

I guess the cause of this problem is luby codec , so I base64 encode again after luby codec encode.

I hope this helps you.

Your code solved my problem, thanks.

However, this foutain code version lacks for a user-friendly progress info, so it's hard to knowo how long it will take.

Do you have any idea on this?

And I found that in current code, it always returns zero:

// Length returns length of the decoded data.
// TODO: remove
func (d *Decoder) Length() int {
    return 0
}

// Read returns amount of currently read bytes.
// TODO: remove
func (d *Decoder) Read() int {
    return 0
}