Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/security/lockstore/lockstore_rs/src/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 1 kB image not shown  

Quelle  utils.rs

  Sprache: Rust
 

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


use crate::LockstoreError;
use kvstore::Value;

/// Convert bytes to a kvstore Value (stored as base64 JSON string)
pub fn bytes_to_value(bytes: &[u8]) -> Result<Value, LockstoreError> {
    use base64::Engine;
    let base64_str = base64::engine::general_purpose::STANDARD.encode(bytes);
    let json_val = serde_json::Value::String(base64_str);
    Ok(Value::from(json_val))
}

/// Extract bytes from a kvstore Value (stored as base64 JSON string)
pub fn value_to_bytes(value: &Value) -> Result<Vec<u8>, LockstoreError> {
    use base64::Engine;

    // Extract the string from the JSON value
    let base64_str = value
        .inner()
        .as_str()
        .ok_or_else(|| LockstoreError::Serialization("Expected string value".to_string()))?;

    // Decode from base64
    base64::engine::general_purpose::STANDARD
        .decode(base64_str)
        .map_err(|e| LockstoreError::Serialization(format!("Failed to decode base64: {}", e)))
}

Messung V0.5 in Prozent
C=77 H=98 G=88

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet am  2026-08-25) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.