  We prove new upper bounds on the smallest size of affine blocking sets, that
is, sets of points in a finite affine space that intersect every affine
subspace of a fixed codimension. We show an equivalence between affine blocking
sets with respect to codimension-$2$ subspaces that are generated by taking a
union of lines through the origin, and strong blocking sets in the
corresponding projective space, which in turn are equivalent to minimal codes.
Using this equivalence, we improve the current best upper bounds on the
smallest size of a strong blocking set in finite projective spaces over fields
of size at least $3$. Furthermore, using coding theoretic techniques, we
improve the current best lower bounds on strong blocking set.
  Our main motivation for these new bounds is their application to trifferent
codes, which are sets of ternary codes of length $n$ with the property that for
any three distinct codewords there is a coordinate where they all have distinct
values. Over the finite field $\mathbb{F}_3$, we prove that minimal codes are
equivalent to linear trifferent codes. Using this equivalence, we show that any
linear trifferent code of length $n$ has size at most $3^{n/4.55}$, improving
the recent upper bound of Pohoata and Zakharov. Moreover, we show the existence
of linear trifferent codes of length $n$ and size at least $\frac{1}{3}\left(
9/5 \right)^{n/4}$, thus (asymptotically) matching the best lower bound on
trifferent codes.
  We also give explicit constructions of affine blocking sets with respect to
codimension-$2$ subspaces that are a constant factor bigger than the best known
lower bound. By restricting to~$\mathbb{F}_3$, we obtain linear trifferent
codes of size at least $3^{23n/312}$, improving the current best explicit
construction that has size $3^{n/112}$.
