Code of box2d lite
float rn1 = Dot(r1, c->normal);
float rn2 = Dot(r2, c->normal);
float kNormal = body1->invMass + body2->invMass;
kNormal += body1->invI * (Dot(r1, r1) - rn1 * rn1) + body2->invI * (Dot(r2, r2) - rn2 * rn2);
c->massNormal = 1.0f / kNormal;
C^2 = A^2 + B^2 // Teorema de pitagoras
C^2 = Dot(r1,r1)
A^2 = rn1 * rn1
B^2 = C^2 - A^2
//another way to formulate it
float rcn1 = Cross(r1, c->normal);
float rcn2 = Cross(r2, c->normal);
float kNormal = body1->invMass + body2->invMass;
kNormal += body1->invI * rcn1 * rcn1 + body2->invI * rcn2 * rcn2;
c->massNormal = 1.0f / kNormal;
B^2 = rnc1 * rnc1
And there are still more ways to formulate the same