Given (a, b) ∈ Z 2 , Euclid's algorithm outputs the generator gcd(a, b) of the ideal aZ + bZ. Computing a lattice basis is a high-dimensional generalization: given a 1 ,. .. , a n ∈ Z m , find a Z-basis of the lattice L = { n i=1 x i a i , x i ∈ Z} generated by the a i 's. The fastest algorithms known are HNF algorithms, but are not adapted to all applications, such as when the output should not be much longer than the input. We present an algorithm which extracts such a short basis within the same time as an HNF, by reduction to HNF. We also present an HNF-less algorithm, which reduces to Euclid's extended algorithm and can be generalized to quadratic forms. Both algorithms can extend primitive sets into bases.