MCPcopy Index your code
hub / github.com/RustPython/RustPython / format_serial_number

Function format_serial_number

crates/stdlib/src/ssl/cert.rs:209–215  ·  view source on GitHub ↗

Format certificate serial number to hexadecimal string with even padding Converts a BigUint serial number to uppercase hex string, ensuring even length by prepending '0' if necessary.

(serial: &num_bigint::BigUint)

Source from the content-addressed store, hash-verified

207/// Converts a BigUint serial number to uppercase hex string, ensuring
208/// even length by prepending '0' if necessary.
209fn format_serial_number(serial: &num_bigint::BigUint) -> String {
210 let mut serial_str = serial.to_str_radix(16).to_uppercase();
211 if serial_str.len() % 2 == 1 {
212 serial_str.insert(0, '0');
213 }
214 serial_str
215}
216
217/// Normalize wildcard hostname by stripping "*." prefix
218///

Callers 2

cert_to_dictFunction · 0.85
cert_der_to_dict_helperFunction · 0.85

Calls 3

to_uppercaseMethod · 0.80
lenMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected