A 4-algebra is a commutative algebra A over a field k such that (a 2 ) 2 = 0, for all a ∈ A. We have proved recently [20] that 4-algebras play a prominent role in the classification of finite dimensional Bernstein algebras. Let A be a 4-algebra, E a vector space and π : E → A a surjective linear map with V = Ker(π). All 4-algebra structures on E such that π : E → A is an algebra map are described and classified by a global cohomological object GH 2 (A, V ). Any such 4-algebra is isomorphic to a crossed product V #A and GH 2 (A, V ) is a coproduct, over all 4-algebras structures •V on V , of all non-abelian cohomologies H 2 nab A, (V, •V ) , which are the classifying objects for all extensions of A by V . Several applications and examples are provided: in particular, GH 2 (A, k) and GH 2 (k, V ) are explicitly computed and the Galois group Gal (V #A/V ) of the extension V ֒→ V #A is described.