KIM Beazley has told how Australia cracked top-secret American combat aircraft codes while he was defence minister in the 1980s.

"We spied on them and we extracted the codes," Mr Beazley told Parliament during his valedictory speech today.

Mr Beazley, who was defence minister from 1984 to 1990, said that when he took over the job he soon learned that the radar on Australia's Hornets could not identify most potentially hostile aircraft in the region.

In other words, Australia's frontline fighter could not shoot down enemies in the region.

Mr Beazley said he was greatly tempted to "belt" the Liberals with this and lay to rest their claim to be best at managing defence.

"I shut up, I said nothing," Mr Beazley said.

"I went to the US and for five years, up hill and down dale, with one knock-down, drag-out after another, with Cap Weinberger, Dick Cheney, Paul Wolfowitz, I tried to get the codes of that blasted radar out of them.

"In the end we spied on them and we extracted the codes ourselves and we got another radar that could identify (enemy planes).

Mr Beazley said the Americans were Australia's most important ally.

"But they are a bunch of people you have to have a fight with every now and then to get what you actually need out of them," he said.

Mr Beazley said that the story of getting the Hornet codes was well known within Defence, but not beyond it.

He said the problem was that the old codes related to Warsaw Pact aircraft, rather than ones in Australia's region.

The Americans kept saying they'd provide the codes, but never did.

"So we tried to crack the codes so we could enhance them," Mr Beazley said.

"And we made a lot of progress."

Mr Beazley said the Americans knew what the Australians were doing and were intrigued by the progress they made.