The algebra of rack and quandle cohomology