Skip to content
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

Why K doesn't need copy from fixed column? #766

Open
qy3u opened this issue Apr 10, 2023 · 0 comments
Open

Why K doesn't need copy from fixed column? #766

qy3u opened this issue Apr 10, 2023 · 0 comments

Comments

@qy3u
Copy link

qy3u commented Apr 10, 2023

While reading the code of the sha256 gadgets,I found that the K for calculateh_prime was assigned from a u32 table(ROUND_CONSTANTS) directly.

// H' = H + Ch(E, F, G) + s_upper_sigma_1(E) + K + W
let h_prime = self.assign_h_prime(
region,
round_idx,
h,
ch,
ch_neg,
sigma_1,
ROUND_CONSTANTS[round_idx.as_usize()],
schedule_word,
)?;

// Assign k
let k: [bool; 32] = i2lebsp(k.into());
let k_lo: [bool; 16] = k[..16].try_into().unwrap();
let k_hi: [bool; 16] = k[16..].try_into().unwrap();
{
AssignedBits::<16>::assign_bits(region, || "k_lo", a_6, row - 1, Value::known(k_lo))?;
AssignedBits::<16>::assign_bits(region, || "k_hi", a_6, row, Value::known(k_hi))?;
}

In my understanding, if you want to limit the value of a cell to some constant, you should copy it from a fixed column,but obvisously it's not the way here.So, Did i miss something or My understanding to constants in halo2 was wrong?

@qy3u qy3u changed the title Why K doen't need copy from fixed column? Why K doesn't need copy from fixed column? Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant