Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.

Runaway Five posted:

I have a question and a half.

When you use the STL Standard Map, it is implemented as a "Binary Tree" and therefore runs in O(lg) time.

Is there a STL form of a hash table, one that would work in O(k) time and preferably have a subscript operator? Thanks in advance.
std::tr1::unordered_map, from the header <unordered_map>. If you're on Windows, you'll need to install the Standard C++ Library TR1 Extensions

quote:

Also, is there such a thing as a hash map?
Map, table, same difference.

Adbot
ADBOT LOVES YOU

TSDK
Nov 24, 2003

I got a wooden uploading this one

Runaway Five posted:

Is there a STL form of a hash table, one that would work in O(k) time and preferably have a subscript operator? Thanks in advance.

Also, is there such a thing as a hash map?
There isn't one that's part of the STL yet, but if you're after something that's going to be fairly standards conforming then go with Boost.Unordered:
http://www.boost.org/doc/libs/1_37_0/doc/html/unordered.html

AreYouIn
Aug 31, 2001


You've to be shitting me.
So I have a macro in SPSS 14 I used written by someone who has since left the project. The macro exports tables from SPSS to excel and then groups them. I recently upgraded to Office 2007 and now the macro doesn't work. Debugging it tracks the error here the arrow is below. When that happens I get the following error: "10091ActiveX Automation: no such property or method."

Any thoughts? it pastes the table into Excel but when it needs to covert from an object it seems to die.

code:
Sub ExcelMacro(NumLayerDim As Long)
' This macro
'	adds a Table number to the title of each table
'	turns that line bold and blue
'	groups the other lines of the table so that it is easy to
'	have only titles visible in excel (this facilitates locating
'	any given table). The Table number facilitates the programming of Word
' 	to insert a given table in word in a specified point in a document.
' 	Raynald Levesque 2002/05/19

	Dim line1 As Long
	Dim line2 As Long
	Dim col1 As Integer
	Dim col2 As Integer

	On Error GoTo ErrExcelMacro
	With objExcelApp

		If tablenb=0 Then
			tablenb = CInt(strTableNb)  tablenb 

			'Format whole excel sheet to comma with no decimals
			Dim intRow, intCol As Integer
			'intRow = .Selection.Rows
			'intCol = .Selection.Columns
			'.Range(.ActiveCell, .ActiveCell.End(xlDown).End(xlToRight)).Select
			'.Selection.style = "Comma"
			'.Selection.NumberFormat = "_-* #,##0_-;-* #,##0_-;_-* ""-""??_-;_-@_-"
			'.Cells(intRow, intCol).Select
		Else
			tablenb = tablenb 
		End If

error-------->	line1 = .Selection.Row - 1  
		line2 = .Selection.Rows(.Selection.Rows.Count).Row - 1
		col1 = .Selection.Column
		col2 = .Selection.Columns(.Selection.Columns.Count).Column
		' Add a table number in the first line, make title bold & blue
				'with RYAN HUDSON title hack
		Dim ryan As String
		ryan = .Cells(line1,col1)

		If .Cells(line1,col1) = " " Then
			If .Cells(line1,col1) = "" Then
				If .Cells(line1,col1) = "" Then
					If .Cells(line1,col1) = "" Then
						ryan = .Cells(line1,col1)
					Else
						ryan = .Cells(line1,col1)
					End If
				Else
					ryan = .Cells(line1,col1)
				End If
			Else
				ryan = .Cells(line1,col1)
			End If
		End If
		'msgbox .Cells(line1, col1)
		If .Cells(line1,col1) = "Report" Then
			If .Cells(line1, col1) = "" Then
				ryan = .Cells(line1,col1) & .Cells(line1,col1)
			Else
				ryan = .Cells(line1, col1)
			End If
		End If
		''''''''''''''''''''''''''''''''''''''''
				.Cells(line1, col1)= "Table" & Str(tablenb) & " â&#128;&#148; " & ryan
		If NumLayerDim > 0 Then
			'.Cells(line1, col1)= .Cells(line1, col1) & " " & .Cells(line1  1, col1)
		End If
		.cells(line1,col1).font.bold=True
		.cells(line1,col1).font.size=8
		.cells(line1,col1).Font.ColorIndex = 11

  'Font.ColorIndex = 1 (for Black)	  'Font.ColorIndex = 2 (for White)	  
  'Font.ColorIndex = 3 (for Red)	  'Font.ColorIndex = 4 (for Light Green)	  
  'Font.ColorIndex = 5 (for Blue)	  'Font.ColorIndex = 6 (for Yellow)	  
  'Font.ColorIndex = 7 (for Pink)	  'Font.ColorIndex = 8 (for Light Blue)	  
  'Font.ColorIndex = 9 (for Brown)	  'Font.ColorIndex = 10 (Green)	  
  'Font.ColorIndex = 11 (for Dark Blue)	  'Font.ColorIndex = 13 (for Purple)

		.ActiveWorkbook.Names.Add Name:="Table" & LTrim(Str(tablenb)), RefersTo:=.Selection

		'Select the table lines (except the title) and group the lines
		.Range(.Cells(line1  1, col1), .Cells(line2  1, col2)).Select
		.Selection.Rows.Group
		.selection.font.size=8
	End With
	Exit Sub

	ErrExcelMacro:
		Debug.Print Err.Number & Err.Description
		MsgBox Err.Number & Err.Description
		Exit Sub
End Sub

Nahrix
Mar 17, 2004

Can't afford to eat out
(Language: C)

I'm trying to read from either a file, or stdin, one character at a time.

code:
FILE *file;
// logic for file = fopen or stdin based on user choice
// my problem is specifically when: file = stdin;

while ((intValue = fgetc(file)) != EOF)
{
  // reading/executing stuff
}
This works fine for a file, but for stdin, it executes the code when input is taken and the user hits enter, then prompts for more input, indefinitely. How can I check for the end of the first stdin input, and stop the code normally at that point? I'm looking for a solution that can act on both stdin and an actual file, using the same file pointer.

Thanks.

Nahrix fucked around with this message at 07:02 on Nov 7, 2008

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
Just type Ctrl+D for EOF.

(Probably doesn't work on Windows, but 1) I don't want to doublecheck, 2) gently caress Windows anyway)

Nahrix
Mar 17, 2004

Can't afford to eat out
Oh, sorry. To clarify, I just want to user to type something in and hit enter.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Avenging Dentist posted:

Just type Ctrl+D for EOF.

(Probably doesn't work on Windows, but 1) I don't want to doublecheck, 2) gently caress Windows anyway)

IIRC, it's Ctrl+Z on Windows, although who the gently caress knows what that does to stdin in a Windows terminal.

Nahrix, there are two problems you'll have when using a terminal. The first is that terminal input is line-buffered by default, so you won't get your 'character at a time' until the user hits enter. The second is that, yes, EOF is a little weird on a stream attached to a terminal. That said, I don't really see the difficulty; just invent an 'end' command, check for it in the loop, and break if you see it?

rjmccall fucked around with this message at 07:21 on Nov 7, 2008

Vanadium
Jan 8, 2005

Nahrix posted:

Oh, sorry. To clarify, I just want to user to type something in and hit enter.

Replace EOF with '\n'?

ante
Apr 9, 2005

SUNSHINE AND RAINBOWS
If you want character at a time, you can use getch and kbhit. My idiot programming teacher has a hardon for them.

Vanadium
Jan 8, 2005

ante posted:

If you want character at a time, you can use getch and kbhit. My idiot programming teacher has a hardon for them.

Pft, nonstandard functions are cheating.

ZorbaTHut
May 5, 2005

wake me when the world is saved
Here's a wacky question.

I need an algorithm for anonymous distributed reputation. Distributed reputation is tough, but I can't come up with any possible way to make it anonymous. I'm guessing it's just not possible, but I'm wondering if there's any research along those lines :) Any suggestions?

ante
Apr 9, 2005

SUNSHINE AND RAINBOWS

Vanadium posted:

Pft, nonstandard functions are cheating.

He also tells us to ALWAYS use nodep.h

What is nodep.h, you say?

It contains all of two lines, both #defines that suppress deprecation warnings. He gives us an installer to run on all of the machines we code on to place nodep.h in the proper folder.

Because your program should be completely free of deprecation warnings, no matter how important they are.:bang:

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

ZorbaTHut posted:

Here's a wacky question.

I need an algorithm for anonymous distributed reputation. Distributed reputation is tough, but I can't come up with any possible way to make it anonymous. I'm guessing it's just not possible, but I'm wondering if there's any research along those lines :) Any suggestions?

Collaborative signing algorithms can be applied to this in theory, I guess. The concept of anonymous reputation seems very nearly contradictory, though; what's your actual problem domain?

tef
May 30, 2004

-> some l-system crap ->

ZorbaTHut posted:

Here's a wacky question.

I need an algorithm for anonymous distributed reputation. Distributed reputation is tough, but I can't come up with any possible way to make it anonymous. I'm guessing it's just not possible, but I'm wondering if there's any research along those lines :) Any suggestions?

I would suggest the following things in order:
  • cry
  • restrict the problem domain some more

Does this help any - I remember this being at a codecon:

http://www.geekness.net/tools/aura/

Can't you just rely on the network layer to provide anonynimity )and what is your threat model for it anyway)?

That Turkey Story
Mar 30, 2003

ante posted:

He also tells us to ALWAYS use nodep.h

What is nodep.h, you say?

It contains all of two lines, both #defines that suppress deprecation warnings. He gives us an installer to run on all of the machines we code on to place nodep.h in the proper folder.

Because your program should be completely free of deprecation warnings, no matter how important they are.:bang:

In his defense, if you are using Visual C++, Microsoft foolishly "deprecated" ISO C++ functions in favor of Microsoft "safe" versions.

PT6A
Jan 5, 2006

Public school teachers are callous dictators who won't lift a finger to stop children from peeing in my plane

Nahrix posted:

(Language: C)

I'm trying to read from either a file, or stdin, one character at a time.

code:
FILE *file;
// logic for file = fopen or stdin based on user choice
// my problem is specifically when: file = stdin;

while ((intValue = fgetc(file)) != EOF)
{
  // reading/executing stuff
}
This works fine for a file, but for stdin, it executes the code when input is taken and the user hits enter, then prompts for more input, indefinitely. How can I check for the end of the first stdin input, and stop the code normally at that point? I'm looking for a solution that can act on both stdin and an actual file, using the same file pointer.

Thanks.

Is there a reason why this sort of thing wouldn't work:

code:

int endOfInput;

if (file==stdin) endOfInput = '\n';
else endOfInput = EOF;

while ((intValue = fgetc(file)) != endOfInput)
{
  // reading/executing stuff
}

Nosy_G
May 6, 2007

I sorta feel silly posting an Excel question here, but I'm stuck on this one.

My problem:
  • LARGE(array, 1)
  • LARGE(array, 2)
  • LARGE(array, 3)
all return the value of the exact same cell, so when I try to VLOOKUP w/ these formulas I get 3 references to the same cell. How can I manage to ignore the value if the cell's already been listed?

ZorbaTHut
May 5, 2005

wake me when the world is saved

ShoulderDaemon posted:

Collaborative signing algorithms can be applied to this in theory, I guess. The concept of anonymous reputation seems very nearly contradictory, though; what's your actual problem domain?

tef posted:

Can't you just rely on the network layer to provide anonynimity )and what is your threat model for it anyway)?

World of Warcraft. Yeah, I'm a geek.

I want a system where people can rate other players up or down based on their skill. A good distributed reputation system can take care of most malicious behavior, but the fundamental problem is that the points of data - as near as I can tell - must be public out of necessity. Which means if I rate Jimbo as "awful", Jimbo can find out about this.

I'm trying to come up with any possible way I can make it "safer" to rate people down, such that the algorithm still works but people don't have to end up in dramabomb situations. I'm failing, and I'm not sure it's possible, but I'd feel more comfortable if I could somehow prove it was not possible.

Right now it's mostly annoying me.

tef
May 30, 2004

-> some l-system crap ->

ZorbaTHut posted:

World of Warcraft. Yeah, I'm a geek.

quote:

I want a system where people can rate other players up or down based on their skill.

How will you deal with cycles ?

quote:

I'm failing, and I'm not sure it's possible, but I'd feel more comfortable if I could somehow prove it was not possible.

If it's distributed, then it's public. There might be some really really smart ways around this, but you're just raising the bar for attacks.

quote:

Right now it's mostly annoying me.

Technical solutions to social problems often work out this way.

ZorbaTHut
May 5, 2005

wake me when the world is saved

tef posted:

How will you deal with cycles ?

It's pretty easy to come up with some moderately clever graph-theory methods to deduce someone's reputation based off your own. You build a little bit of falloff into the model and it'll converge on some value. Not a problem.

tef posted:

If it's distributed, then it's public. There might be some really really smart ways around this, but you're just raising the bar for attacks.

I'm not convinced about this. There exist quite a few fascinating secure distributed protocols for complicated things (for example, choosing random values is a classic example).

I agree that, in the most obvious form of the algorithm, when everyone needs to know exactly what everyone has rated everyone else, it's impossible to hide data. That said, I don't know if it's possible to accomplish the same thing while still preserving anonymity in any sense, or what the whole shebang would look like. That's what I'm curious about.

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

ZorbaTHut posted:

I agree that, in the most obvious form of the algorithm, when everyone needs to know exactly what everyone has rated everyone else, it's impossible to hide data. That said, I don't know if it's possible to accomplish the same thing while still preserving anonymity in any sense, or what the whole shebang would look like. That's what I'm curious about.

Edit: removed some bad implementations that you really shouldn't use

There's a blind signature scheme that kind of works for this situation, but it requires slightly esoteric encryption. Assume Alice is trying to rate Bob.
  • Alice has a private key with functions Aencrypt, Adecrypt.
  • Bob has a public key with functions Bsign, Bverify. Bverify is known to the world.
  • Bob has some mechanism to verify the identity of Alice.
  • Adecrypt(Bsign(Aencrypt(data))) = Bsign(data).
  • Alice wants to make rating statement foo against Bob.
  • Alice sends Bob Aencrypt(foo).
  • Bob cannot read the rating, but can verify that he is talking to Alice and has never let Alice rate him before.
  • Bob either refuses the rating, or sends back Bsign(Aencrypt(foo)).
  • Alice computes Adecrypt(Bsign(Aencrypt(foo))) to get Bsign(foo), which can be published at Alice's discretion.
  • Anyone checking Bob's ratings does so by examining published ratings which are correctly signed by Bob.
  • In this system, the ratings could be "I rate Bob poorly" or Asign("I, Alice, rate Bob poorly"); the rater is free to insert identity into the ratings (which may increase their strength, depending on your reputation algorithm) or leave them anonymous.
You can use RSA for the public keys, and a blinding multiply for the private encryption. I just checked, and Schneier has a section on this in Applied Crypto, 23.12 "Blind Signatures"; if you search, you can probably find other implementations.

If you can depend on a central ratings clearinghouse there are simpler solutions. Clearinghouses can trivially mask rater data by simply executing the reputation algorithm themselves and only returning concrete results.

ShoulderDaemon fucked around with this message at 22:11 on Nov 9, 2008

ZorbaTHut
May 5, 2005

wake me when the world is saved

ShoulderDaemon posted:

There's a blind signature scheme that kind of works for this situation, but it requires slightly esoteric encryption. Assume Alice is trying to rate Bob.[list]

Well that's pretty dang clever. I suppose the only objection I have is that the obvious thing for Bob to say is "okay, I've signed it, now you have to reveal what it is" and, of course, 99% of people will reveal it instantly unless it's bad. Kind of an instant giveaway.

Also, if a group goes badly, everyone would probably just reject rating requests from everyone else ("ha ha can't rate me down now, sucka!")

That said, while I'm not sure it works for this place, it's pretty drat neat and is definitely bordering on the problem space I'm looking at. I need to go pick up a copy of that book.

ShoulderDaemon posted:

If you can depend on a central ratings clearinghouse there are simpler solutions. Clearinghouses can trivially mask rater data by simply executing the reputation algorithm themselves and only returning concrete results.

Agreed, this would make everything massively simpler - unfortunately it's just plain not possible :(

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

ZorbaTHut posted:

Well that's pretty dang clever. I suppose the only objection I have is that the obvious thing for Bob to say is "okay, I've signed it, now you have to reveal what it is" and, of course, 99% of people will reveal it instantly unless it's bad. Kind of an instant giveaway.

Also, if a group goes badly, everyone would probably just reject rating requests from everyone else ("ha ha can't rate me down now, sucka!")

If we admit some DRM, I think this is doable:

All messages to be tagged by some globally unique number, ideally a large random nonce.

When Alice and Bob first meet, Alice has Bob blind-sign two messages: a good rating, and a bad rating. As many times as he wants, Bob has Alice reveal both messages then discard them and repeat the exchange: this is to convince Bob that Alice is not cheating by generating two bad ratings or two good ratings or messages with non-unique identifiers. The final pair is not revealed to Bob.

At any later time, Alice may simultaneously publish one message and discard the other. It's important that the software handling this makes a strong effort to prevent saving a message after its pair has been published, as Alice needs this for plausible deniability: If Bob tries to find out who published a bad rating, he can ask people who have published ratings about him, but they can just point to any published good rating and claim that was their own. Bob could get around this by demanding they show him an unpublished bad rating (which would prove that if they published at all, it was a good rating); this is why Alice should not be able to save the unpublished member of a pair.

ZorbaTHut
May 5, 2005

wake me when the world is saved

ShoulderDaemon posted:

If we admit some DRM, I think this is doable:

That's kind of clever also, and actually not entirely infeasible. It doesn't really rely on DRM, it just relies on plausible deniability, and if the default implementation does exactly that, then you can't really expect people to have the alternate message lying around.

In this case, there's still unfortunately two major issues:

* First, while we have a working "rating" system, we don't have any kind of a "web of trust" system. It's pretty easily breakable by just generating a billion "this guy is awesome" messages - since there's no way to tell whether the person who wrote a message is a guy you trust or not, there isn't really a way to tell whether a message should be trusted or not.

* Second, it relies on the ratee using the software also, which I can't guarantee. I'd like this to work on people who aren't using the software - obviously they won't be able to give out ratings, but they should be ratable, otherwise the entire thing kind of collapses.

I think this solves a totally fascinating problem that I didn't even think was solvable, though :D

This is definitely going to take more thought, you're bringing up some very neat constructions that I never considered before.

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

ZorbaTHut posted:

First, while we have a working "rating" system, we don't have any kind of a "web of trust" system. It's pretty easily breakable by just generating a billion "this guy is awesome" messages - since there's no way to tell whether the person who wrote a message is a guy you trust or not, there isn't really a way to tell whether a message should be trusted or not.

Orthogonal problem. Trusting someone's ability to rank people accurately is completely different from trusting their in-game behaviour. Manage trust with a public-key-and-signed-affidavit system, like PGP.

You'd want to allow ratings to be either signed or unsigned, and have a (probably configurable) default weight for unsigned- or signed-by-unreachable- ratings.

If you want signatures and anonymous ratings, then you can have the software examine trust networks, identify medium-to-large-sized groups of people it is part of that have positive minimal intertrust, and negotiate to create a new pseudo-identity that everyone in the group holds the private key for, and everyone trusts with the same minimal intertrust they have with the rest of the group. Then anyone in that group can sign ratings with the pseudo-identity's key instead of their own, and plausibly claim someone else in the group published that rating, but the trust web still finds the signer and assigns it an appropriate trust weight (no worse than the path to the least-trusted person in the group).

You can probably score pseudo-identities based on the minimal intertrust they represent multiplied by the number of users known to hold the key; that gives you a function that approaches some "useful anonymity" metric which the software can use to decide what identities to use when signing rankings. There's an externality where you want to make sure that the group includes other people likely to issue rankings for the rankee; you probably need to defer to the user somehow for that.

ZorbaTHut posted:

Second, it relies on the ratee using the software also, which I can't guarantee. I'd like this to work on people who aren't using the software - obviously they won't be able to give out ratings, but they should be ratable, otherwise the entire thing kind of collapses.

You might be able to get away with just the pseudo-identity solution I posted above, and having ratings signed by the ranker (or ranker's pseudo-identity) rather than by the rankee. This opens up to allowing ranking-spam against a person, however.

A better solution is to allow rankings to be optionally signed by the rankee using the old protocol, in addition to optionally signed by the ranker (or a pseudo-identity). If the rankee is a user of the software (that is, if they have a published public key), then vastly reduce the weight (possibly to zero? you need some protection against people who publish a key then never agree to ranking exchanges, though. Better might be to make reputation from [-1, 1] but unsigned ranks can only shift it in the range [-0.5, 0.5] or so) on rankings not signed by them. So, you can rank people who don't use the software, but if they want protection against ranking-spam, they have incentive to use the software and publish a key. That not only lets them rank other people and view their own rank, it also protects them from spam and makes other users more confident that their ranking is genuine.

There are still a few issues. A person can create a pseudo-identity with a group of other people, then use that identity to sign positive rankings for himself. You probably want to forbid "self-signatures" of this form, so just enforce that pseudo-identities can't sign rankings on their members. That's a really hard problem, because it assumes that the machines of everyone who has a key for a given pseudo-identity are secure (otherwise someone could hack in to one, steal a key, and use that pseudo-identity to sign rankings on themselves). This is a very hard problem, and you need to get into serious revocation systems for trust webs and a complicated nested-identity publishing scheme. And there's pretty much nothing stopping someone from generating positive rankings for themself that are unsigned by a ranker or signed by a ranker that's not part of the trust web; all you can do is depend on the trust web to weight those poorly and limit their impact.

Edit: Oh yeah, there's a flaw in the protocol I had above for paired-rank-exchange. Alice sends Bob two down-ranks, Bob signs, sends them back, then demands a disclosure and protocol restart (to check if Alice is cheating), Alice simply disconnects and later publishes both down-ranks. Bob lacks an effective revocation system, and if we gave him one he could use it against published down-ranks and artifically boost his reputation. You have to depend on trusting the software here, or move to a doubly-blinded protocol. A simple augmentation may be that Bob uses a separate, unpublished key to sign all the responses that he intends to immediately demand disclosure on, so Alice can't usefully publish them; this is probably the best way to solve the problem, but it does add some overhead in terms of additional keys. Note that Bob has to sign them somehow, otherwise he has no real evidence that Alice isn't sending two down-ranks, then when asked to disclose, responding with a down-rank and an up-rank.

ShoulderDaemon fucked around with this message at 00:50 on Nov 10, 2008

oldkike
Jan 10, 2003

hey

www.pleasegimmeadollar.com

ShoulderDaemon posted:

Edit: removed some bad implementations that you really shouldn't use

There's a blind signature scheme that kind of works for this situation, but it requires slightly esoteric encryption. Assume Alice is trying to rate Bob.
  • Alice has a private key with functions Aencrypt, Adecrypt.
  • Bob has a public key with functions Bsign, Bverify. Bverify is known to the world.
  • Bob has some mechanism to verify the identity of Alice.
  • Adecrypt(Bsign(Aencrypt(data))) = Bsign(data).
  • Alice wants to make rating statement foo against Bob.
  • Alice sends Bob Aencrypt(foo).
  • Bob cannot read the rating, but can verify that he is talking to Alice and has never let Alice rate him before.
  • Bob either refuses the rating, or sends back Bsign(Aencrypt(foo)).
  • Alice computes Adecrypt(Bsign(Aencrypt(foo))) to get Bsign(foo), which can be published at Alice's discretion.
  • Anyone checking Bob's ratings does so by examining published ratings which are correctly signed by Bob.
  • In this system, the ratings could be "I rate Bob poorly" or Asign("I, Alice, rate Bob poorly"); the rater is free to insert identity into the ratings (which may increase their strength, depending on your reputation algorithm) or leave them anonymous.
You can use RSA for the public keys, and a blinding multiply for the private encryption. I just checked, and Schneier has a section on this in Applied Crypto, 23.12 "Blind Signatures"; if you search, you can probably find other implementations.

If you can depend on a central ratings clearinghouse there are simpler solutions. Clearinghouses can trivially mask rater data by simply executing the reputation algorithm themselves and only returning concrete results.

What kind of encryption do you use where Adecrypt(Bsign(X)) == Bsign(Adecrypt(X)) ?

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

oldkike posted:

What kind of encryption do you use where Adecrypt(Bsign(X)) == Bsign(Adecrypt(X)) ?

There's a few methods, but the simplest is RSA and blinding multiplication.

Basically, Bob has an RSA key Bpri, Bpub, and n. Alice picks a random integer in [1, n] called Amul. Alice wants to get the message txt signed.
  • Alice computes blind = txt * Amul^Bpub mod n
  • Bob computes sblind = blind^Bpri mod n
  • Alice computes stxt = sblind/Amul mod n
  • With a little number theory, you can show stxt = txt^Bpri mod n, which is the RSA signing function.
And, uh, don't implement this from what I've said, because I'm kind of tired right now and probably made a typo. But it's called Chaum blind signatures, and you should be able to find a better-written description and proof with some google work.

oldkike
Jan 10, 2003

hey

www.pleasegimmeadollar.com

ShoulderDaemon posted:

There's a few methods, but the simplest is RSA and blinding multiplication.

Basically, Bob has an RSA key Bpri, Bpub, and n. Alice picks a random integer in [1, n] called Amul. Alice wants to get the message txt signed.
  • Alice computes blind = txt * Amul^Bpub mod n
  • Bob computes sblind = blind^Bpri mod n
  • Alice computes stxt = sblind/Amul mod n
  • With a little number theory, you can show stxt = txt^Bpri mod n, which is the RSA signing function.
And, uh, don't implement this from what I've said, because I'm kind of tired right now and probably made a typo. But it's called Chaum blind signatures, and you should be able to find a better-written description and proof with some google work.

Ah, that's really cool. So its really kind of a one time pad encryption before signing.. I googled and this wikipedia article has a very concise summary: http://en.wikipedia.org/wiki/Blind_signature

A.Spectre
May 30, 2004

Stalking her way into our hearts
My girlfriend has been making fun little comic strips from funny situations we've been in, talked about, or just kinda made up. Recently we decided to start putting them online as a webcomic. I've been searching for a nice template or layout for something like that but I can't find one that really fits a webcomic. I would make one myself but I have very limited skills in CSS.

So my question is, is there a website that teaches CSS without going incredibly in depth? I already know HTML on the web end and C++ on the programming end(completely unrelated, I know.)

Secondly, does anyone know of a few good templates for something like this?

Vanadium
Jan 8, 2005

Krimlander posted:

Secondly, does anyone know of a few good templates for something like this?

You should ask in the webcomics thread in BSS.

A.Spectre
May 30, 2004

Stalking her way into our hearts

Vanadium posted:

You should ask in the webcomics thread in BSS.

Never even saw that or thought to look there. Thank you!

hallik
Aug 15, 2003
I am trying to go through some training for C# CD's and having problems with this example. Apparently it works fine on their end, but I get an error
"the type or namespace 'Lion'does not exist in the namespace 'CD3'.

I didn't see any universal C# thread, so I came here. Help?

code:
using System;

namespace CD3
{
    public interface ICarnivore
    {
        string Hunt();
        string Eat();
    }

    public abstract class Animal : ICarnivore
    {
        public abstract string Hunt();
        public string Eat()
        {
            return "Carnivores are meat eaters";
        }
    }

    public class Lion:Animal
    {
        public Lion()
        {
        }
        public override string Hunt()
        {
            return "A lion stalks its prey";
        }
    }

    class CreateAnimal
    {
        public static void DisplayCarnivore(ICarnivore c)
        {
            Console.WriteLine(c.Hunt());
            Console.WriteLine(c.Eat());
        }

        static void Main(string[] args)
        {
[b]            Lion l = new Lion();[/b] //Error line
            CreateAnimal.DisplayCarnivore(l);
          
        }
    }
}

Vanadium
Jan 8, 2005

Works for me too. There is a general .NET thread.

You are not splitting this up into multiple files, are you?

hallik
Aug 15, 2003

Vanadium posted:

Works for me too. There is a general .NET thread.

You are not splitting this up into multiple files, are you?

Actually, it was split into a couple different files, I haven't tried it as posted. What would the difference be?

<e> They had it in multiple files, and I split it up like that and ended up copying almost their entire layout to try and figure it out. When I put it all in one file it works fine. I made sure the namespace was exactly the same on all pages.

Although it works on one page, I probably need to understand why it didn't work over multiple pages as I learn more and end up referencing things from different code files. Where did I go wrong?

hallik fucked around with this message at 20:39 on Nov 11, 2008

Vanadium
Jan 8, 2005

Welp, I just figured it might have to do with the package visibility thing, but I am not sure how that works because I am not in fact a .NET developer, so I just pasted everything together and then it worked.

Edit: I am using mono

hallik
Aug 15, 2003

Vanadium posted:

Welp, I just figured it might have to do with the package visibility thing, but I am not sure how that works because I am not in fact a .NET developer, so I just pasted everything together and then it worked.

Edit: I am using mono

OK Thanks. Maybe I will try the .NET thread to have the difference explain

Savings Clown
May 7, 2007

We all float down here
I'm trying to use the CFileDialog::GetFolderPath() function in C++ to return a string value containing a folder path (eg "C:/Documents") instead of a single file (eg "C:/Documents/results.csv").

code:
void CFileReadDlg::OnPath() 
{
	CFileDialog cFileDlg(TRUE, "*.csv", NULL, OFN_EXPLORER, NULL);	
	int nRet = cFileDlg.DoModal();
	//strFolder = cFileDlg.GetPathName();
	strFolder = cFileDlg.GetFolderPath();
}
The above code works fine for the commented-out GetPathName for choosing individual files, but the assertion for ASSERT(::IsWindow(m_hWnd)) comes back null for GetFolderPath().

Help?

JoeNotCharles
Mar 3, 2005

Yet beyond each tree there are only more trees.

Savings Clown posted:

I'm trying to use the CFileDialog::GetFolderPath() function in C++ to return a string value containing a folder path (eg "C:/Documents") instead of a single file (eg "C:/Documents/results.csv").

code:
void CFileReadDlg::OnPath() 
{
	CFileDialog cFileDlg(TRUE, "*.csv", NULL, OFN_EXPLORER, NULL);	
	int nRet = cFileDlg.DoModal();
	//strFolder = cFileDlg.GetPathName();
	strFolder = cFileDlg.GetFolderPath();
}
The above code works fine for the commented-out GetPathName for choosing individual files, but the assertion for ASSERT(::IsWindow(m_hWnd)) comes back null for GetFolderPath().

What assert? I don't see any assert there, or any m_hWnd. Did you forget to paste half your sample code, or did you ask the wrong question?

Savings Clown
May 7, 2007

We all float down here
Sorry, yeah, it's in the MFC library for CFileDialog

code:
CString CFileDialog::GetFolderPath() const
{
	ASSERT(::IsWindow(m_hWnd));
	ASSERT(m_ofn.Flags & OFN_EXPLORER);

	CString strResult;
	if (GetParent()->SendMessage(CDM_GETFOLDERPATH, (WPARAM)MAX_PATH, (LPARAM)strResult.GetBuffer(MAX_PATH)) < 0)
		strResult.Empty();
	else
		strResult.ReleaseBuffer();
	return strResult;
}
Edit: this no longer actually matters because I'm now unemployed.

Savings Clown fucked around with this message at 09:12 on Nov 12, 2008

Adbot
ADBOT LOVES YOU

Painless
Jan 9, 2005

Turn ons: frogs, small mammals, piles of compost
Turn offs: large birds, pitchforks
See you at the beach!
Is there an easy to use C or C++ API that allows me to capture data from a webcam? Being cross-platform would be nice but I can deal with just windows. I'd just rather not delve into directshow/whatever the hell it's called these days if I can avoid it.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply