ch algorithm