Given a vector of bits v, compute the collection of bits that have Hamming distance 1 with v, then with distance 2, up to an input paramet
First: There is a bijection between hamming dist k bit-vectors and subsets (of n aka v.size()) of kardinality k (the set of indices with changed bits). Hence, I'd enumerate the subsets of changed indices instead. A quick glance at the SO history shows this reference. You'd have to keep track of the correct cardinalitites of course.
Considering efficiency is probably pointless, since the solution to your problem is exponential anyways.