  We give deterministic polynomial-time algorithms that, given an order,
compute the primitive idempotents and determine a set of generators for the
group of roots of unity in the order. Also, we show that the discrete logarithm
problem in the group of roots of unity can be solved in polynomial time. As an
auxiliary result, we solve the discrete logarithm problem for certain unit
groups in finite rings. Our techniques, which are taken from commutative
algebra, may have further potential in the context of cryptology and computer
algebra.
