#![cfg_attr(all(not(feature = "std"), not(test)), no_std)]
#![deny(missing_docs)]
#![deny(rustdoc::broken_intra_doc_links)]
#![cfg_attr(docsrs, feature(doc_cfg))]
mod addr;
mod elf;
mod exit_code;
mod hash;
mod image;
mod povw;
mod sys_state;
use anyhow::Result;
use risc0_zkp::core::digest::Digest;
pub use self::image::{MemoryImage, Page, KERNEL_START_ADDR};
pub use crate::{
addr::{ByteAddr, WordAddr},
elf::{AbiKind, Program, ProgramBinary, ProgramBinaryHeader},
exit_code::{ExitCode, InvalidExitCodeError},
hash::{tagged_iter, tagged_list, tagged_list_cons, tagged_struct, Digestible},
povw::{PovwJobId, PovwLogId, PovwNonce},
sys_state::{read_sha_halfs, write_sha_halfs, DecodeError, SystemState},
};
pub(crate) const WORD_SIZE: usize = 4;
const PAGE_BYTES: usize = 1024;
pub(crate) const PAGE_WORDS: usize = PAGE_BYTES / WORD_SIZE;
pub fn compute_image_id(blob: &[u8]) -> Result<Digest> {
ProgramBinary::decode(blob)?.compute_image_id()
}