Why is diffie-hellman-group1-sha1 used instead of diffie-hellman? For SSH why is Diffie-Hellman-group1-sha1 used instead of just Diffie-Hellman? In other words, why is the hash function used?
This has been specified by the standard, steps 4 and 5 of the protocol described in RFC 4253:


  
  S generates a random number y (0 &lt; y &lt; q) and computes
    f = g^y mod p.  S receives e.  It computes K = e^y mod p,
    H = hash(V_C || V_S || I_C || I_S || K_S || e || f || K)
    (these elements are encoded according to their types; see below),
    and signature s on H with its private host key.  S sends
    (K_S || f || s) to C.  The signing operation may involve a
    second hashing operation.
  C verifies that K_S really is the host key for S (e.g., using
    certificates or a local database).  C is also allowed to accept
    the key without verification; however, doing so will render the
    protocol insecure against active attacks (but may be desirable for
    practical reasons in the short term in many environments).  C then
    computes K = f^x mod p, H = hash(V_C || V_S || I_C || I_S || K_S
    || e || f || K), and verifies the signature s on H.
  
  This value (H) is called the exchange hash, and it is used to
  authenticate the key exchange.  The exchange hash SHOULD be kept
  secret.
  
  The signature algorithm MUST be applied over H, not the original
  data.  Most signature algorithms include hashing and additional
  padding (e.g., "ssh-dss" specifies SHA-1 hashing).  In that case, the
  data is first hashed with HASH to compute H, and H is then hashed
  with SHA-1 as part of the signing operation.
  


It then goes to define diffie-hellman-group1-sha1, just to show that SHA-1 is indeed the hash mentioned above:


  The "diffie-hellman-group1-sha1" method specifies the Diffie-Hellman
     key exchange with SHA-1 as HASH, and Oakley Group 2 [RFC2409] (1024-
     bit MODP Group).  This method MUST be supported for interoperability
     as all of the known implementations currently support it.  Note that
     this method is named using the phrase "group1", even though it
     specifies the use of Oakley Group 2.




So basically it is a hash over the parameters used for the key exchange. Without it the parameters may be changed by an attacker (the "active attacks" in the description) and the exchange would not be authenticated.