-
Notifications
You must be signed in to change notification settings - Fork 605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added text.base64Encode and text.base64Decode #1742
Conversation
Fixes #1587 |
case 0 => | ||
buffer = (cidx & 0x3f) | ||
mod += 1 | ||
case 1 => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case 1 | 2
might make intent a little clearer
case 0 => Right(Chunk.empty) | ||
case 1 => Left("Final base 64 quantum had only 1 digit - must have at least 2 digits") | ||
case 2 => | ||
Right(Chunk(((state.buffer >> 4) & 0x0ff).toByte)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this is 0x0ff
vs 0xff
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, old habit. Fixing.
) | ||
) | ||
Pull.output1(out) | ||
case _ => sys.error("carry must be size 0, 1, or 2") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding the invalid carry size in the error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally LGTM. Had a few small comments and think it might benefit from a couple additional test cases.
@matthughes Want to take a quick look at updates from review? |
Adapted the implementations from scodec-bits for streaming / continuation.