I suppose you mean the “Protection: Bash” / “Cut” entries in the item information window in game. They are calculated in [tt]item::bash_resist[/tt] and [tt]item::cut_resist[/tt] in src/item.cpp, I’ll paraphrase:
bash protection is [tt]resist * eff_thickness * 1.5[/tt] (rounded the usual way at 0.5)
[tt]resist[/tt] is the average of the bash resistance of all the contained materials (sum of resistance of all materials divided by number of materials). Bash resistance is defined in the json data of the material.
[tt]eff_thickness[/tt] is the thickness of the armor (lowered for damaged values). Thickness is defined in the json data of the armor (it’s called [tt]material_thickness[/tt] there).
It’s the same for cutting, just with the materials cutting resistance.
I can’t find any reference to the layering there.