Benign cargo Download

encode.rs

Rust test marker or harness
SHA-2567f6413ad27bf135f1fe38866a661a7300610905d8c858aff52eff2fd9e02a441
MaleculeMd(Pa)

Evidence

imports byteorder::BigEndian lines 1–11
1use byteorder::{BigEndian, ByteOrder};
2use {Config, STANDARD};
3
4///Encode arbitrary octets as base64.
5///Returns a String.
6///Convenience for `encode_config(input, base64::STANDARD);`.
7///
8///# Example
9///
10///```rust
11///extern crate base …
English function-word token "the" lines 50–56
50:6… code arbitrary octets as base64.
51///Writes into the supplied output buffer, which will grow the buffer if needed.
52///
53///# Example
54///
55///```rust
56/ …
English function-word token "this" lines 81–84
81:5… Writes into the supplied output buffer.
82///
83/// This is useful if you wish to avoid allocation entirely (e.g. encoding into a stack-resident
84/// or …
English function-word token "have" lines 97–101
97:14… ut buf = Vec::new();
98/// // make sure we'll have a slice big enough for base64 + padding
99/// buf.resize(s.len() * 4 / 3 + 4, 0);
100///
101/// …
imports decode::decode_config_buf lines 312–337
⋯5 lines
317}
318
319#[cfg(test)]
320mod tests {
321 extern crate rand;
322
323 use super::*;
324 use decode::decode_config_buf;
325 use tests::{assert_encode_sanity, random_config};
326 use {Config, STANDARD, URL_SAFE_NO_PAD};
327
328 use self::rand::distributions::{Distribution, Range};
329 use self::rand::{Rng, FromEntropy};
330 use std;
331 use std::str;
332
333 #[test]
334 fn encoded_size_correct_standard() {
335 assert_encoded_length(0, 0, STANDARD);
336
337 assert_encoded_length(1, 4, ST …

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.