Harley darts into a decrepit room in Connecticut. She's searching for evidence.

There are plenty of potential distractions in the room: Wires hang from the ceiling. Warped wood paneling buckles away from the walls. Faded yellow cabinets look like someone kicked a hole in them.

"Are you ready to go to work?" Brett Hochron, a detective with the Westchester County Police, in New York, asks his partner.

Harley immediately spots a lighter on a table and grabs it. She starts drooling. It's a cold February afternoon, but Harley is focused. The basket of tennis balls next to the table doesn't even get a glance.

That's because Harley is a very good dog.

She's also a graduate of an elite K-9 search class that trains dogs to sniff out electronics, including phones, hard drives and microSD cards smaller than your thumb.

Now playing: Watch this: This dog is trained to find computers and stop crimes

Sarah Tew/CNET

Only one out of every 50 dogs tested qualifies to become an electronic storage detection, or ESD, dog, says Kerry Halligan, a K-9 instructor with the Connecticut State Police. That's because it's a lot harder to detect the telltale chemical in electronics than it is to sniff out narcotics, bombs, fire accelerants or people, she says.

But Labrador retrievers like Harley, with their long snouts and big muzzles, can pick up even the faintest olfactory clues. These tech-seeking dogs are helping law enforcement find child pornography stashed in hidden hard drives, uncover concealed phones, nab white-collar evidence kept on hard drives and track calls stored on SIM cards.

The most famous case occurred in 2015, when a Labrador retriever named Bear found a hidden flash drive containing child pornography in the home of former Subway spokesman Jared Fogle. The district attorney called the discovery vital to Fogle's conviction.

"It's not the bloody knife anymore," Hochron says of clues in modern-day crimes. "It's the search history on a laptop that someone tried to burn."

Tales from the underdog

Dogs are built to smell.

Where we might smell pizza, a dog could pick out the wheat in the crust and the tomatoes, oregano, basil and mozzarella in the topping. A dog trainer told the Australian Broadcasting Corp. that if you took all the olfactory receptor cells out of a human and spread them with a butter knife, you would get a smear the size of a postage stamp. A dog's smelling cells would cover a tea towel.

So it made sense when a major in the Connecticut State Police's computer crimes department asked its K-9 academy — the longest-running K-9 police school in the US — if a dog could sniff out thumb drives.

To find out, Jack Hubball, a chemist with Connecticut's Forensic Science Laboratory, ordered thumb drives, SD cards and hard drives from multiple manufacturers. And he learned all memory devices use a chemical compound called triphenylphosphine oxide, or TPPO. That was the break they needed.

Once they had isolated the common chemical, the state's K-9 trainers could begin to train the first ESD dog in 2012. They spent up to six months "imprinting" the chemical odor on a black Lab named Selma.

Over and over again, they got her to smell a white, odorless (to us) powder, and then fed her. Selma eventually associated the scent with food and would search out the smell for a reward. And she found devices that had completely escaped investigators. They kept the program a secret for four years, says Halligan, to make sure there weren't any surprise issues.

Where we might smell pizza, a dog could pick out the wheat in the crust and the tomatoes, oregano, basil and mozzarella in the topping.

In 2016, the Connecticut State Police told the world what they had been up to, and held their first public class that spring. The five graduating dogs went to the FBI and the police forces in Alaska, Massachusetts, Missouri and Virginia. As of February, there were at least 17 ESD dogs in the US, Hochron estimates.

Who's a good dog?

Halligan has three requirements when she looks for ESD candidates.

"The biggest criteria are: Are you brave? Are you energetic? Do you like food?" she says.

Food motivation is the most important. That's why all the ESDs she's trained are Labradors. The breed has a much bigger appetite than any other dogs she's trained.

"She is so food-driven that I could feed her a can right now, and she could still work an hour later," Hochron says of Harley.

All the dogs that Halligan has tested were bred to be guide dogs but were too energetic and too bold for that role.

She also looks for rebellious dogs: Halligan says she'll test about 100 dogs that were all trained not to grab food from the counter. She wants the ones that break that training.

She'll also put kibble in odd spots — like on a shelf or the top of a running washing machine — to see if the dog will explore on its own.

Sarah Tew/CNET

Halligan then introduces the animal to new distractions, such as other dogs and playtime. The ones that stay with her for the food pass the test. Out of the 100 or so dogs, only a small handful make it.

Harley is the ninth ESD dog Halligan has trained.

A dog's life

Until they retire, all food-motivated search dogs are allowed to eat only after smelling the chemical they've been imprinted on. That keeps up their work mentality.

Harley gets fed only during searches, when she'll get a handful of kibble for every device that she finds. If there's no investigation, Hochron will find new search opportunities, like getting a friend to hide electronics around the house. One friend even asked Hochron if Harley could help find a missing iPhone after its battery died. (The family found the phone before Harley had a chance to look.)

"From the day she starts training to the day she retires, she will never eat out of a bowl," says Halligan.

Hochron has it a little easier than other dog handlers, since he's surrounded by electronics. Those with narcotics- and bomb-sniffing dogs need to always have the illegal goods nearby for their dogs to smell before they can feed them, Halligan says.

But the dogs do get a break once a week, when they can eat something they don't need to search for. On those days, they can get treats like sweet potatoes or eggs. Harley enjoys two dried-out quarter-pound patties on her treat days, Hochron says.

What's that, girl?

Harley's like a different dog when she's in work mode.

Instead of the laid-back dog who loves to roll on her belly, Harley gets agitated when she smells something that might be TPPO: She sniffs the area, wags her tail, drools and begins to pace until she turns around, sits and faces Hochron. She can barely stay still, as if she has a secret she wants him to find. When he does, she gets a handful of kibble.

Mark Mann

In the demonstration I watched, Harley found 10 items in a room she'd never been in before. Some were obvious, like a phone under a couch, but others were inconspicuous devices that would be easy to miss, even for a trained eye. She even sniffed a coat hook that Halligan told me was actually a surveillance camera.

Harley is happy and fed after finding all the devices. She lies down on the floor, satisfied with her meal but ready to go again if Hochron needs her to. She's been on 17 real searches since graduating last summer. She still goes through training every day.

"When it's time to search, you're going to see a whole different critter," Hochron says. "But otherwise, she's just a silly puppy."

This story appears in the summer 2018 edition of CNET Magazine. Click here for more magazine stories.

Culture: Your hub for everything from film and television to music, comics, toys and sports.

Rebooting the Reef: CNET dives deep into how tech can help save Australia's Great Barrier Reef.