This spring, computer science lecturer Nicholas Weaver will give a class of UC Berkeley undergraduates a novel yet practical assignment: build a National Security Agency-style surveillance system.

Using primary source materials, including NSA PowerPoint slides leaked by former contractor Edward Snowden, students will replicate the techniques — not the scale — of the world’s most powerful security apparatus.

“What (the NSA does) and what I have been doing has this huge amount of common overlap,” said Weaver last month at the Enigma Conference in San Francisco.

“So, when others look at the Snowden slides and say: ‘OMG, the NSA is hacking the planet,’ I say: ‘Oh, they did that, they did that, and they did that.’”

Understanding such surveillance operations is of huge importance to students who, after graduation, could wind up working on ways to evade them — or even help improve them.

“If you really want to protect your network, you really have to know your network,” said Rob Joyce, chief of tailored access operations for the NSA. “You have to know the devices and the security technologies and the security behind it.

“It’s minute attention to detail — knowing that network, knowing that space,” he said at the same conference.

Weaver has delved deeply into federal surveillance programs as a researcher at the International Computer Science Institute at Berkeley.

The NSA’s systems of surveillance, Weaver said, are essentially wiretaps.

Weaver’s students will build miniature versions: a device the size of a lunchbox that can monitor all the Internet traffic from a hotel; a machine the size of a plug-in air freshener that can surveil all the Wi-Fi traffic coming from a Starbucks.

Though the slides leaked by Snowden do not include step-by-step instructions for creating such devices, they include clues that computer science students and academics now study.

Of particular focus is XKeyscore — a program that reportedly uses fiber-optic cables to monitor Internet traffic, including searches, e-mails, documents, user names and passwords, among other private communications.

Weaver hopes his devices will be capable of doing that. But students will use them to monitor only their own network traffic, not anyone else’s, and certainly not the college’s.

“You want to monitor yourself,” Weaver said. “It gives you a respect for how powerful and dangerous this monitoring is, but at the same time for how essential it is.”

Weaver is also having his students bounce signals off the firewall that acts to censor all of China’s Internet traffic. Known as the Great Firewall, it represents a vast surveillance apparatus — making it a fitting subject of study.

Recently, Berkeley began planning to closely monitor its own network, sparking privacy concerns among faculty. The school’s intrusion-detection technology would be capable of capturing and analyzing all the network traffic to and from campus.

That makes the exercise doubly practical for Weaver’s class.

“It’s also just cool,” he said. “It’s a great thing to say that top-secret NSA projects make great undergraduate homework assignments.”

Sean Sposito is a San Francisco Chronicle staff writer. E-mail: ssposito@sfchronicle.com Twitter: @seansposito