With two pairs of fine-tipped tweezers and the hands of a surgeon, Cheryl Hayashi began dissecting the body of a silver garden spider under her microscope.

In just a few minutes she found what she was seeking: hundreds of silk glands, the organs spiders use to make their webs. Some looked like mashed potatoes, others like green worms or air-filled rubber gloves. Each lets the spider produce a different type of silk.

Some silk types can be stretchy, others stiff. Some dissolve in water, others repel it.

“They make so many kinds of silk!” Hayashi said. “That’s just what boggles my mind.”

Cheryl Hayashi uses a microscope to work on a spider at her lab at the American Museum of Natural History in New York. Jeremy Rehm / AP

Hayashi has collected spider silk glands of about 50 species, just a small dent in the more than 48,000 spider species known worldwide. Her lab at the American Museum of Natural History is uncovering the genes behind each type of silk to create a sort of “silk library.” It’s part of an effort to learn how spiders make so many kinds of silk and what allows each kind to behave differently.

The library could become an important storehouse of information for designing new pesticides and better materials for bulletproof vests, space gear, biodegradable fishing lines and even fashionable dresses.

Hayashi has been at this for 20 years, but improved technology only recently let scientists analyze the DNA of silk faster and produce artificial spider silk in bulk.

“Any function that we can think of where you need something that requires a lightweight material that’s very strong, you can look to spider silk,” Hayashi said.

Spider silks all start out the same: a wad of goo, akin to rubber cement or thick honey, as Hayashi describes it. Spiders make and stash it in a gland until they want to use the silk. Then, a narrow nozzle called a spigot opens. And as the goo flows out, it morphs into a solid silk strand that is weaved with other strands emerging from other spigots.

Nobody knows how many kinds of spider silks exist, but some species can produce a variety. Orb-weaving spiders, for example, make seven types. One has a sticky glue to catch prey. Another is tough but stretchy to absorb the impact of flying insects. The spider dangles from a third type that’s as tough as steel.

How and why silks behave in these various ways is a puzzle, but the secret likely lies in genes. Finding those genes, though, isn’t easy.

Until recently, scientists had to first chop the glands’ DNA into pieces and have a computer try to put the sequence back together like a jigsaw puzzle. That’s a daunting task, and it’s especially difficult for spiders, because their genes are very long and repetitive.

It’s as if the sentence “The quick brown fox jumps over the lazy dog” is instead, “The quick brown fox jumps, jumps, jumps, jumps, jumps, jumps, jumps, jumps over the lazy dog,” said Sarah Stellwagen from the University of Maryland, Baltimore County. If you have no idea what the sentence says and have to rebuild it from a shredded mess of thousands of copies, how do you know how many “jumps” to put into it?

That’s the problem Stellwagen faced when she recently determined the entire set of genes, and their DNA makeup, for spider silk glue. She’d thought she could do it fairly quickly, but it took almost two years.

Scientists have to recover the full gene to truly mimic natural silk, she said. If they try to produce synthetic silk from just part of a gene or some lab-built stunted version, “it’s not as good as what a spider makes,” Stellwagen said.

That’s the issue researchers and companies have had in the past using genetically modified yeast, microbes and even goats to make synthetic silk. Only last year did a group make a small amount that perfectly mimicked an orb-weaving spider’s dragline silk, the type it dangles from, using bacteria.

But that was only one type of silk from one species. Hayashi asked: “What about the other 48,000?”

Technology has improved. Researchers can now determine genes from beginning to end without first chopping them up. And companies have gotten ever closer to mass-produced synthetic silks.

Now, it’s a matter of uncovering the secrets of the potentially thousands of other silks out there.

It’s a hard task, considering the many spiders she has yet to study and that some are about the size of the period at the end of this sentence.

“But hey, you know, we all have goals,” she said.

Want more stories about science?

Follow NBC News MACH on Twitter and Facebook and Instagram.